summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-19 18:06:56 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-19 18:54:03 +0100
commit3aec87c0092e1394652e0108003b8b35fe191c0e (patch)
tree7894cfae8d733ac738e5b529b153df3993b37021 /rbutil/rbutilqt
parent93ed5baf77ebcc369f14769afb76cd7da1204a2d (diff)
downloadrockbox-3aec87c0092e1394652e0108003b8b35fe191c0e.tar.gz
rockbox-3aec87c0092e1394652e0108003b8b35fe191c0e.tar.bz2
rockbox-3aec87c0092e1394652e0108003b8b35fe191c0e.zip
Move Info tab content to a separate widget.
Change-Id: I39a4e035372920f05f5fb3ab5bfc9459314997ad
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/gui/infowidget.cpp100
-rw-r--r--rbutil/rbutilqt/gui/infowidget.h39
-rw-r--r--rbutil/rbutilqt/gui/infowidgetfrm.ui43
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp77
-rw-r--r--rbutil/rbutilqt/rbutilqt.h3
-rw-r--r--rbutil/rbutilqt/rbutilqt.pri3
-rw-r--r--rbutil/rbutilqt/rbutilqtfrm.ui27
7 files changed, 195 insertions, 97 deletions
diff --git a/rbutil/rbutilqt/gui/infowidget.cpp b/rbutil/rbutilqt/gui/infowidget.cpp
new file mode 100644
index 0000000000..9cd974ef31
--- /dev/null
+++ b/rbutil/rbutilqt/gui/infowidget.cpp
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2012 by Dominik Riebeling
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <QtGui>
+#include <QDebug>
+#include "infowidget.h"
+#include "rbsettings.h"
+
+InfoWidget::InfoWidget(QWidget *parent) : QWidget(parent)
+{
+ ui.setupUi(this);
+
+ ui.treeInfo->setAlternatingRowColors(true);
+ ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
+ ui.treeInfo->expandAll();
+ ui.treeInfo->setColumnCount(2);
+ ui.treeInfo->setLayoutDirection(Qt::LeftToRight);
+}
+
+
+void InfoWidget::updateInfo(void)
+{
+ qDebug() << "[InfoWidget] updating server info";
+
+ QString mp = RbSettings::value(RbSettings::Mountpoint).toString();
+ QSettings log(mp + "/.rockbox/rbutil.log", QSettings::IniFormat, this);
+ QStringList groups = log.childGroups();
+ QList<QTreeWidgetItem *> items;
+ QTreeWidgetItem *w, *w2;
+ QString min, max;
+ int olditems = 0;
+
+ // remove old list entries (if any)
+ int l = ui.treeInfo->topLevelItemCount();
+ while(l--) {
+ QTreeWidgetItem *m;
+ m = ui.treeInfo->takeTopLevelItem(l);
+ // delete childs (single level deep, no recursion here)
+ int n = m->childCount();
+ while(n--)
+ delete m->child(n);
+ }
+ // get and populate new items
+ for(int a = 0; a < groups.size(); a++) {
+ log.beginGroup(groups.at(a));
+ QStringList keys = log.allKeys();
+ w = new QTreeWidgetItem;
+ w->setFlags(Qt::ItemIsEnabled);
+ w->setText(0, groups.at(a));
+ items.append(w);
+ // get minimum and maximum version information so we can hilight old files
+ min = max = log.value(keys.at(0)).toString();
+ for(int b = 0; b < keys.size(); b++) {
+ if(log.value(keys.at(b)).toString() > max)
+ max = log.value(keys.at(b)).toString();
+ if(log.value(keys.at(b)).toString() < min)
+ min = log.value(keys.at(b)).toString();
+ }
+
+ for(int b = 0; b < keys.size(); b++) {
+ QString file;
+ file = mp + "/" + keys.at(b);
+ if(QFileInfo(file).isDir())
+ continue;
+ w2 = new QTreeWidgetItem(w, QStringList() << "/"
+ + keys.at(b) << log.value(keys.at(b)).toString());
+ if(log.value(keys.at(b)).toString() != max) {
+ w2->setForeground(0, QBrush(QColor(255, 0, 0)));
+ w2->setForeground(1, QBrush(QColor(255, 0, 0)));
+ olditems++;
+ }
+ items.append(w2);
+ }
+ log.endGroup();
+ if(min != max)
+ w->setData(1, Qt::DisplayRole, QString("%1 / %2").arg(min, max));
+ else
+ w->setData(1, Qt::DisplayRole, max);
+ }
+ ui.treeInfo->insertTopLevelItems(0, items);
+ ui.treeInfo->expandAll();
+ ui.treeInfo->resizeColumnToContents(0);
+ ui.treeInfo->collapseAll();
+}
+
diff --git a/rbutil/rbutilqt/gui/infowidget.h b/rbutil/rbutilqt/gui/infowidget.h
new file mode 100644
index 0000000000..2285b05c8b
--- /dev/null
+++ b/rbutil/rbutilqt/gui/infowidget.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2012 by Dominik Riebeling
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef INFOWIDGET_H
+#define INFOWIDGET_H
+
+#include <QtGui>
+#include "ui_infowidgetfrm.h"
+
+class InfoWidget : public QWidget
+{
+ Q_OBJECT
+ public:
+ InfoWidget(QWidget *parent = 0);
+
+ public slots:
+ void updateInfo(void);
+
+ private:
+ Ui::InfoWidgetFrm ui;
+};
+
+#endif
+
diff --git a/rbutil/rbutilqt/gui/infowidgetfrm.ui b/rbutil/rbutilqt/gui/infowidgetfrm.ui
new file mode 100644
index 0000000000..41ac46f8dc
--- /dev/null
+++ b/rbutil/rbutilqt/gui/infowidgetfrm.ui
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>InfoWidgetFrm</class>
+ <widget class="QWidget" name="InfoWidgetFrm">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelInfo">
+ <property name="text">
+ <string>Currently installed packages.&lt;br/&gt;&lt;b&gt;Note:&lt;/b&gt; if you manually installed packages this might not be correct!</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QTreeWidget" name="treeInfo">
+ <column>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 310f775ff6..4836cf567d 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -39,6 +39,7 @@
#include "systeminfo.h"
#include "ziputil.h"
#include "manualwidget.h"
+#include "infowidget.h"
#include "progressloggerinterface.h"
@@ -121,11 +122,11 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
mantablayout->addWidget(manual);
// info tab
- ui.treeInfo->setAlternatingRowColors(true);
- ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
- ui.treeInfo->expandAll();
- ui.treeInfo->setColumnCount(2);
- ui.treeInfo->setLayoutDirection(Qt::LeftToRight);
+ QGridLayout *infotablayout = new QGridLayout(this);
+ ui.info->setLayout(infotablayout);
+ info = new InfoWidget(this);
+ infotablayout->addWidget(info);
+
// disable quick install until version info is available
ui.buttonSmall->setEnabled(false);
ui.buttonComplete->setEnabled(false);
@@ -205,7 +206,7 @@ void RbUtilQt::updateTabs(int count)
{
switch(count) {
case 6:
- updateInfo();
+ info->updateInfo();
break;
default:
break;
@@ -1135,70 +1136,6 @@ void RbUtilQt::installPortable(void)
}
-void RbUtilQt::updateInfo()
-{
- qDebug() << "[RbUtil] updating server info";
-
- QString mp = RbSettings::value(RbSettings::Mountpoint).toString();
- QSettings log(mp + "/.rockbox/rbutil.log", QSettings::IniFormat, this);
- QStringList groups = log.childGroups();
- QList<QTreeWidgetItem *> items;
- QTreeWidgetItem *w, *w2;
- QString min, max;
- int olditems = 0;
-
- // remove old list entries (if any)
- int l = ui.treeInfo->topLevelItemCount();
- while(l--) {
- QTreeWidgetItem *m;
- m = ui.treeInfo->takeTopLevelItem(l);
- // delete childs (single level deep, no recursion here)
- int n = m->childCount();
- while(n--)
- delete m->child(n);
- }
- // get and populate new items
- for(int a = 0; a < groups.size(); a++) {
- log.beginGroup(groups.at(a));
- QStringList keys = log.allKeys();
- w = new QTreeWidgetItem;
- w->setFlags(Qt::ItemIsEnabled);
- w->setText(0, groups.at(a));
- items.append(w);
- // get minimum and maximum version information so we can hilight old files
- min = max = log.value(keys.at(0)).toString();
- for(int b = 0; b < keys.size(); b++) {
- if(log.value(keys.at(b)).toString() > max)
- max = log.value(keys.at(b)).toString();
- if(log.value(keys.at(b)).toString() < min)
- min = log.value(keys.at(b)).toString();
- }
-
- for(int b = 0; b < keys.size(); b++) {
- QString file;
- file = mp + "/" + keys.at(b);
- if(QFileInfo(file).isDir())
- continue;
- w2 = new QTreeWidgetItem(w, QStringList() << "/"
- + keys.at(b) << log.value(keys.at(b)).toString());
- if(log.value(keys.at(b)).toString() != max) {
- w2->setForeground(0, QBrush(QColor(255, 0, 0)));
- w2->setForeground(1, QBrush(QColor(255, 0, 0)));
- olditems++;
- }
- items.append(w2);
- }
- log.endGroup();
- if(min != max)
- w->setData(1, Qt::DisplayRole, QString("%1 / %2").arg(min, max));
- else
- w->setData(1, Qt::DisplayRole, max);
- }
- ui.treeInfo->insertTopLevelItems(0, items);
- ui.treeInfo->resizeColumnToContents(0);
-}
-
-
QUrl RbUtilQt::proxy()
{
QUrl proxy;
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h
index e10569ff2f..5c0694a019 100644
--- a/rbutil/rbutilqt/rbutilqt.h
+++ b/rbutil/rbutilqt/rbutilqt.h
@@ -33,6 +33,7 @@
#include "progressloggergui.h"
#include "bootloaderinstallbase.h"
#include "manualwidget.h"
+#include "infowidget.h"
class RbUtilQt : public QMainWindow
{
@@ -45,6 +46,7 @@ class RbUtilQt : public QMainWindow
private:
ManualWidget *manual;
+ InfoWidget *info;
Ui::RbUtilQtFrm ui;
void changeEvent(QEvent *e);
@@ -111,7 +113,6 @@ class RbUtilQt : public QMainWindow
void uninstall(void);
void uninstallBootloader(void);
void installPortable(void);
- void updateInfo(void);
void updateTabs(int);
void checkUpdate(void);
diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri
index 308a08585e..86813c4abe 100644
--- a/rbutil/rbutilqt/rbutilqt.pri
+++ b/rbutil/rbutilqt/rbutilqt.pri
@@ -18,6 +18,7 @@
# common files
SOURCES += \
gui/manualwidget.cpp \
+ gui/infowidget.cpp \
rbutilqt.cpp \
main.cpp \
installwindow.cpp \
@@ -80,6 +81,7 @@ SOURCES += \
HEADERS += \
gui/manualwidget.h \
+ gui/infowidget.h \
rbutilqt.h \
installwindow.h \
base/httpget.h \
@@ -149,6 +151,7 @@ HEADERS += \
FORMS += \
gui/manualwidgetfrm.ui \
+ gui/infowidgetfrm.ui \
rbutilqtfrm.ui \
aboutbox.ui \
installwindowfrm.ui \
diff --git a/rbutil/rbutilqt/rbutilqtfrm.ui b/rbutil/rbutilqt/rbutilqtfrm.ui
index ff8dda3d7d..ae09e6d163 100644
--- a/rbutil/rbutilqt/rbutilqtfrm.ui
+++ b/rbutil/rbutilqt/rbutilqtfrm.ui
@@ -655,30 +655,6 @@
<attribute name="title">
<string>Inf&amp;o</string>
</attribute>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="labelInfo">
- <property name="text">
- <string>Currently installed packages.&lt;br/&gt;&lt;b&gt;Note:&lt;/b&gt; if you manually installed packages this might not be correct!</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QTreeWidget" name="treeInfo">
- <column>
- <property name="text">
- <string>1</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
</widget>
</widget>
</item>
@@ -690,7 +666,7 @@
<x>0</x>
<y>0</y>
<width>650</width>
- <height>27</height>
+ <height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@@ -971,7 +947,6 @@
<tabstop>buttonVoice</tabstop>
<tabstop>buttonCreateVoice</tabstop>
<tabstop>buttonTalk</tabstop>
- <tabstop>treeInfo</tabstop>
</tabstops>
<resources>
<include location="rbutilqt.qrc"/>