From e7fdf80c175c9dd6a86fbe29556ac6ef7bd8ed29 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 1 Jul 2012 15:02:32 +0200 Subject: Do some minor cleanup. - Move a GUI-only implementation class around. - Make some strings non-translatable which don't make sense translating. - Rename internal state in installation class. There is no current build anymore. Change-Id: I7384c5601de36bc48f858fe5c7b009653d439d94 --- rbutil/rbutilqt/comboboxviewdelegate.cpp | 54 ------------------------ rbutil/rbutilqt/comboboxviewdelegate.h | 30 ------------- rbutil/rbutilqt/gui/comboboxviewdelegate.cpp | 54 ++++++++++++++++++++++++ rbutil/rbutilqt/gui/comboboxviewdelegate.h | 30 +++++++++++++ rbutil/rbutilqt/gui/infowidgetfrm.ui | 4 +- rbutil/rbutilqt/gui/manualwidgetfrm.ui | 2 +- rbutil/rbutilqt/gui/selectiveinstallwidget.cpp | 12 +++--- rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui | 2 +- rbutil/rbutilqt/rbutilqt.cpp | 4 +- rbutil/rbutilqt/rbutilqt.pri | 4 +- 10 files changed, 98 insertions(+), 98 deletions(-) delete mode 100644 rbutil/rbutilqt/comboboxviewdelegate.cpp delete mode 100644 rbutil/rbutilqt/comboboxviewdelegate.h create mode 100644 rbutil/rbutilqt/gui/comboboxviewdelegate.cpp create mode 100644 rbutil/rbutilqt/gui/comboboxviewdelegate.h diff --git a/rbutil/rbutilqt/comboboxviewdelegate.cpp b/rbutil/rbutilqt/comboboxviewdelegate.cpp deleted file mode 100644 index 189f71c95e..0000000000 --- a/rbutil/rbutilqt/comboboxviewdelegate.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2011 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 -#include -#include "comboboxviewdelegate.h" - -void ComboBoxViewDelegate::paint(QPainter *painter, - const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - QPen pen; - QFont font; - pen = painter->pen(); - font = painter->font(); - - painter->save(); - // paint selection - if(option.state & QStyle::State_Selected) { - painter->setPen(QPen(Qt::NoPen)); - painter->setBrush(QApplication::palette().highlight()); - painter->drawRect(option.rect); - painter->restore(); - painter->save(); - pen.setColor(QApplication::palette().color(QPalette::HighlightedText)); - } - else { - pen.setColor(QApplication::palette().color(QPalette::Text)); - } - // draw data (text) - painter->setPen(pen); - painter->drawText(option.rect, Qt::AlignLeft, index.data().toString()); - - // draw user data right aligned, italic - font.setItalic(true); - painter->setFont(font); - painter->drawText(option.rect, Qt::AlignRight, index.data(Qt::UserRole).toString()); - painter->restore(); -} - diff --git a/rbutil/rbutilqt/comboboxviewdelegate.h b/rbutil/rbutilqt/comboboxviewdelegate.h deleted file mode 100644 index 40f6b07d02..0000000000 --- a/rbutil/rbutilqt/comboboxviewdelegate.h +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2011 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 - -class ComboBoxViewDelegate : public QStyledItemDelegate -{ - Q_OBJECT - public: - ComboBoxViewDelegate(QObject* parent = 0) : QStyledItemDelegate(parent) { } - - void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; -}; - diff --git a/rbutil/rbutilqt/gui/comboboxviewdelegate.cpp b/rbutil/rbutilqt/gui/comboboxviewdelegate.cpp new file mode 100644 index 0000000000..189f71c95e --- /dev/null +++ b/rbutil/rbutilqt/gui/comboboxviewdelegate.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2011 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 +#include +#include "comboboxviewdelegate.h" + +void ComboBoxViewDelegate::paint(QPainter *painter, + const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QPen pen; + QFont font; + pen = painter->pen(); + font = painter->font(); + + painter->save(); + // paint selection + if(option.state & QStyle::State_Selected) { + painter->setPen(QPen(Qt::NoPen)); + painter->setBrush(QApplication::palette().highlight()); + painter->drawRect(option.rect); + painter->restore(); + painter->save(); + pen.setColor(QApplication::palette().color(QPalette::HighlightedText)); + } + else { + pen.setColor(QApplication::palette().color(QPalette::Text)); + } + // draw data (text) + painter->setPen(pen); + painter->drawText(option.rect, Qt::AlignLeft, index.data().toString()); + + // draw user data right aligned, italic + font.setItalic(true); + painter->setFont(font); + painter->drawText(option.rect, Qt::AlignRight, index.data(Qt::UserRole).toString()); + painter->restore(); +} + diff --git a/rbutil/rbutilqt/gui/comboboxviewdelegate.h b/rbutil/rbutilqt/gui/comboboxviewdelegate.h new file mode 100644 index 0000000000..40f6b07d02 --- /dev/null +++ b/rbutil/rbutilqt/gui/comboboxviewdelegate.h @@ -0,0 +1,30 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2011 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 + +class ComboBoxViewDelegate : public QStyledItemDelegate +{ + Q_OBJECT + public: + ComboBoxViewDelegate(QObject* parent = 0) : QStyledItemDelegate(parent) { } + + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; +}; + diff --git a/rbutil/rbutilqt/gui/infowidgetfrm.ui b/rbutil/rbutilqt/gui/infowidgetfrm.ui index 41ac46f8dc..8c7fdb30f7 100644 --- a/rbutil/rbutilqt/gui/infowidgetfrm.ui +++ b/rbutil/rbutilqt/gui/infowidgetfrm.ui @@ -11,7 +11,7 @@ - Form + Info @@ -31,7 +31,7 @@ - 1 + Package diff --git a/rbutil/rbutilqt/gui/manualwidgetfrm.ui b/rbutil/rbutilqt/gui/manualwidgetfrm.ui index 8757c4569e..add26736c9 100644 --- a/rbutil/rbutilqt/gui/manualwidgetfrm.ui +++ b/rbutil/rbutilqt/gui/manualwidgetfrm.ui @@ -11,7 +11,7 @@ - Form + Manual diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp index dbbe4afb4d..ec8ce1cc64 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp @@ -63,7 +63,7 @@ void SelectiveInstallWidget::selectedVersionChanged(int index) if(current == "release") ui.selectedDescription->setText(tr("This is the latest stable " "release available.")); - if(current == "current") + if(current == "development") ui.selectedDescription->setText(tr("The development version is " "updated on every code change. Last update was on %1").arg( ServerInfo::value(ServerInfo::BleedingDate).toString())); @@ -89,7 +89,7 @@ void SelectiveInstallWidget::updateVersion(void) // re-populate all version items m_versions.clear(); m_versions.insert("release", ServerInfo::value(ServerInfo::CurReleaseVersion).toString()); - m_versions.insert("current", ServerInfo::value(ServerInfo::BleedingRevision).toString()); + m_versions.insert("development", ServerInfo::value(ServerInfo::BleedingRevision).toString()); m_versions.insert("rc", ServerInfo::value(ServerInfo::RelCandidateVersion).toString()); ui.selectedVersion->clear(); @@ -97,9 +97,9 @@ void SelectiveInstallWidget::updateVersion(void) ui.selectedVersion->addItem(tr("Stable Release (Version %1)").arg( m_versions["release"]), "release"); } - if(!m_versions["current"].isEmpty()) { + if(!m_versions["development"].isEmpty()) { ui.selectedVersion->addItem(tr("Development Version (Revison %1)").arg( - m_versions["current"]), "current"); + m_versions["development"]), "development"); } if(!m_versions["rc"].isEmpty()) { ui.selectedVersion->addItem(tr("Release Candidate (Revison %1)").arg( @@ -116,7 +116,7 @@ void SelectiveInstallWidget::updateVersion(void) ui.selectedVersion->setCurrentIndex(index); } else { - index = ui.selectedVersion->findData("current"); + index = ui.selectedVersion->findData("development"); ui.selectedVersion->setCurrentIndex(index); } // check if Rockbox is installed. If it is untick the bootloader option, as @@ -377,7 +377,7 @@ void SelectiveInstallWidget::installRockbox(void) if(selected == "release") url = ServerInfo::platformValue(m_target, ServerInfo::CurReleaseUrl).toString(); - else if(selected == "current") url = ServerInfo::platformValue(m_target, + else if(selected == "development") url = ServerInfo::platformValue(m_target, ServerInfo::CurDevelUrl).toString(); else if(selected == "rc") url = ServerInfo::platformValue(m_target, ServerInfo::RelCandidateUrl).toString(); diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui b/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui index 25cf44ba90..65a6f18620 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui +++ b/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui @@ -17,7 +17,7 @@ - Form + Selective Installation diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 76c8497a5b..62a4f583f7 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -353,14 +353,14 @@ void RbUtilQt::updateDevice() QString name = QString("%1 (%2)").arg(SystemInfo::value(SystemInfo::CurName).toString(), ServerInfo::value(ServerInfo::CurStatus).toString()); - ui.labelDevice->setText(tr("%1 %2").arg(brand, name)); + ui.labelDevice->setText(QString("%1 %2").arg(brand, name)); QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); QString mountdisplay = QDir::toNativeSeparators(mountpoint); if(!mountdisplay.isEmpty()) { QString label = Utils::filesystemName(mountpoint); if(!label.isEmpty()) mountdisplay += QString(" (%1)").arg(label); - ui.labelMountpoint->setText(tr("%1").arg(mountdisplay)); + ui.labelMountpoint->setText(QString("%1").arg(mountdisplay)); } else { mountdisplay = "(unknown)"; diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri index ebb49f09ec..141c5eea75 100644 --- a/rbutil/rbutilqt/rbutilqt.pri +++ b/rbutil/rbutilqt/rbutilqt.pri @@ -76,7 +76,7 @@ SOURCES += \ quazip/zip.c \ quazip/ioapi.c \ base/ziputil.cpp \ - comboboxviewdelegate.cpp \ + gui/comboboxviewdelegate.cpp \ gui/selectiveinstallwidget.cpp \ gui/backupdialog.cpp \ @@ -148,7 +148,7 @@ HEADERS += \ quazip/zip.h \ base/ziputil.h \ lame/lame.h \ - comboboxviewdelegate.h \ + gui/comboboxviewdelegate.h \ gui/selectiveinstallwidget.h \ gui/backupdialog.h \ -- cgit v1.2.3