mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
Move Info tab content to a separate widget.
Change-Id: I39a4e035372920f05f5fb3ab5bfc9459314997ad
This commit is contained in:
parent
93ed5baf77
commit
3aec87c009
7 changed files with 195 additions and 97 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue