From a4e3cf6f3c7c3054839121a234c19d18f50377b6 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sun, 19 Jan 2014 15:35:45 +0100 Subject: [PATCH] Allow themes and icon preferences --- companion/src/companion.qrc | 129 ++++++---- companion/src/mainwindow.cpp | 133 +++++++---- companion/src/mainwindow.h | 1 + companion/src/preferencesdialog.cpp | 4 + companion/src/preferencesdialog.ui | 355 ++++++++++++++++++---------- 5 files changed, 399 insertions(+), 223 deletions(-) diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index 6f84186da..f56405744 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -37,56 +37,13 @@ images/9xcursmin.png images/9xcursdown.png images/9xcursphoto.png - images/copy.png - images/cut.png - images/currentmodel.png - images/information.png - images/new.png - images/open.png - images/paste.png - images/save.png - images/saveas.png images/screenshot.png images/splash.png images/splasht.png images/companion-title.png - images/read_eeprom.png - images/write_eeprom.png - images/write_flash.png - images/read_flash.png - images/simulate.png - images/configure.png - images/customize.png - images/print.png - images/clear.png - images/add.png - images/edit.png - images/wizard.png - images/duplicate.png - images/fuses.png - images/list.png images/maps.png images/track.png images/track0.png - images/play.png - images/stop.png - images/read_eeprom_file.png - images/write_eeprom_file.png - images/moveup.png - images/movedown.png - images/update.png - images/contributors.png - images/changelog.png - images/preferences.png - images/switch_dir.png - images/exit.png - images/recentdocument.png - images/profiles.png - images/library.png - images/logs.png - images/arrow-left.png - images/arrow-right.png - images/compare.png images/x9b0.png images/x9l0.png images/x9l1.png @@ -335,5 +292,91 @@ images/library/30002.png images/library/30003.png images/library/30004.png + themes/monochrome/open.png + themes/monochrome/edit.png + themes/monochrome/information.png + themes/monochrome/configure.png + themes/monochrome/switch_dir.png + themes/monochrome/list.png + themes/monochrome/wizard.png + themes/monochrome/logs.png + themes/monochrome/new.png + themes/monochrome/save.png + themes/monochrome/recentdocument.png + themes/monochrome/simulate.png + themes/monochrome/changelog.png + themes/monochrome/copy.png + themes/monochrome/write_flash.png + themes/monochrome/read_eeprom_file.png + themes/monochrome/clear.png + themes/monochrome/play.png + themes/monochrome/fuses.png + themes/monochrome/arrow-right.png + themes/monochrome/exit.png + themes/monochrome/moveup.png + themes/monochrome/read_eeprom.png + themes/monochrome/cut.png + themes/monochrome/arrow-left.png + themes/monochrome/write_eeprom_file.png + themes/monochrome/library.png + themes/monochrome/profiles.png + themes/monochrome/paste.png + themes/monochrome/print.png + themes/monochrome/compare.png + themes/monochrome/customize.png + themes/monochrome/saveas.png + themes/monochrome/preferences.png + themes/monochrome/movedown.png + themes/monochrome/currentmodel.png + themes/monochrome/read_flash.png + themes/monochrome/duplicate.png + themes/monochrome/add.png + themes/monochrome/update.png + themes/monochrome/contributors.png + themes/monochrome/stop.png + themes/monochrome/write_eeprom.png + themes/classic/open.png + themes/classic/edit.png + themes/classic/information.png + themes/classic/configure.png + themes/classic/switch_dir.png + themes/classic/list.png + themes/classic/wizard.png + themes/classic/logs.png + themes/classic/new.png + themes/classic/save.png + themes/classic/recentdocument.png + themes/classic/simulate.png + themes/classic/changelog.png + themes/classic/copy.png + themes/classic/write_flash.png + themes/classic/read_eeprom_file.png + themes/classic/clear.png + themes/classic/play.png + themes/classic/fuses.png + themes/classic/arrow-right.png + themes/classic/exit.png + themes/classic/moveup.png + themes/classic/read_eeprom.png + themes/classic/cut.png + themes/classic/arrow-left.png + themes/classic/write_eeprom_file.png + themes/classic/library.png + themes/classic/profiles.png + themes/classic/paste.png + themes/classic/print.png + themes/classic/compare.png + themes/classic/customize.png + themes/classic/saveas.png + themes/classic/preferences.png + themes/classic/movedown.png + themes/classic/currentmodel.png + themes/classic/read_flash.png + themes/classic/duplicate.png + themes/classic/add.png + themes/classic/update.png + themes/classic/contributors.png + themes/classic/stop.png + themes/classic/write_eeprom.png diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 948e2a8e7..eee308d16 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -95,6 +95,15 @@ downloadDialog_forWait(NULL) MaxRecentFiles=MAX_RECENT; QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } restoreGeometry(settings.value("mainWindowGeometry").toByteArray()); createActions(); createMenus(); @@ -1060,14 +1069,14 @@ void MainWindow::burnFrom() QStringList str; str << path << tempFile; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); res = ad->exec(); sleep(1); } } else { QStringList str = GetReceiveEEpromCommand(tempFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); res = ad->exec(); } if(QFileInfo(tempFile).exists() && res) { @@ -1117,14 +1126,14 @@ void MainWindow::burnExtenalToEEPROM() QStringList str; str << path << backupFile; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); sleep(1); } } else { QStringList str = GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); sleep(1); } @@ -1134,7 +1143,7 @@ void MainWindow::burnExtenalToEEPROM() QString tempFlash = tempDir + "/flash.bin"; QStringList str = GetReceiveFlashCommand(tempFlash); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx"); - ad->setWindowIcon(QIcon(":/images/read_flash.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_flash.png")); ad->exec(); sleep(1); QString restoreFile = tempDir + "/compat.bin"; @@ -1167,14 +1176,14 @@ void MainWindow::burnExtenalToEEPROM() QStringList str; str << path << backupFile; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); sleep(1); } } else { QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); sleep(1); } @@ -1189,14 +1198,14 @@ void MainWindow::burnExtenalToEEPROM() QStringList str; str << fileName << path; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write Models and Settings To Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); sleep(1); } } else { QStringList str = GetSendEEpromCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Models and Settings To Tx", AVR_DIALOG_SHOW_DONE); - ad->setWindowIcon(QIcon(":/images/write_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_eeprom.png")); ad->exec(); } } @@ -1361,13 +1370,13 @@ void MainWindow::burnToFlash(QString fileToFlash) } QStringList str = GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); int res = ad->exec(); if (QFileInfo(backupFile).exists() && res) { sleep(1); QStringList str = GetSendFlashCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL); - ad->setWindowIcon(QIcon(":/images/write_flash.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_flash.png")); int res = ad->exec(); if (res) { QString restoreFile = tempDir + "/restore.bin"; @@ -1378,7 +1387,7 @@ void MainWindow::burnToFlash(QString fileToFlash) sleep(1); QStringList str = GetSendEEpromCommand(restoreFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Restore Models and Settings To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL); - ad->setWindowIcon(QIcon(":/images/write_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_eeprom.png")); res=ad->exec(); if (!res) { QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to TX. The models and settings data file can be found at: %1").arg(backupFile)); @@ -1403,14 +1412,14 @@ void MainWindow::burnToFlash(QString fileToFlash) QString backupFile=backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin"; QStringList str = GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); sleep(1); } QStringList str = GetSendFlashCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_SHOW_DONE); - ad->setWindowIcon(QIcon(":/images/write_flash.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_flash.png")); ad->exec(); } } @@ -1431,14 +1440,14 @@ void MainWindow::burnExtenalFromEEPROM() QStringList str; str << path << fileName; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); } } else { settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath()); QStringList str = GetReceiveEEpromCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/images/read_eeprom.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); ad->exec(); } } @@ -1456,7 +1465,7 @@ void MainWindow::burnFromFlash() settings.setValue("lastFlashDir",QFileInfo(fileName).dir().absolutePath()); QStringList str = GetReceiveFlashCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx"); - ad->setWindowIcon(QIcon(":/images/read_flash.png")); + ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_flash.png")); ad->exec(); } @@ -1596,137 +1605,137 @@ MdiChild *MainWindow::createMdiChild() void MainWindow::createActions() { - newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); + newAct = new QAction(QIcon(":/themes/"+Theme+"/new.png"), tr("&New"), this); newAct->setShortcuts(QKeySequence::New); newAct->setStatusTip(tr("Create a new file")); connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); - openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); + openAct = new QAction(QIcon(":/themes/"+Theme+"/open.png"), tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); - loadbackupAct = new QAction(QIcon(":/images/open.png"), tr("&loadBackup..."), this); + loadbackupAct = new QAction(QIcon(":/themes/"+Theme+"/open.png"), tr("&loadBackup..."), this); loadbackupAct->setStatusTip(tr("Load backup from file")); connect(loadbackupAct, SIGNAL(triggered()), this, SLOT(loadBackup())); - saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this); + saveAct = new QAction(QIcon(":/themes/"+Theme+"/save.png"), tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the document to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); - saveAsAct = new QAction(QIcon(":/images/saveas.png"), tr("Save &As..."), this); + saveAsAct = new QAction(QIcon(":/themes/"+Theme+"/saveas.png"), tr("Save &As..."), this); saveAsAct->setShortcuts(QKeySequence::SaveAs); saveAsAct->setStatusTip(tr("Save the document under a new name")); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); - logsAct = new QAction(QIcon(":/images/logs.png"), tr("Lo&gs"), this); + logsAct = new QAction(QIcon(":/themes/"+Theme+"/logs.png"), tr("Lo&gs"), this); logsAct->setShortcut(tr("Ctrl+G")); logsAct->setStatusTip(tr("Open log file")); connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile())); - preferencesAct = new QAction(QIcon(":/images/preferences.png"), tr("&Preferences..."), this); + preferencesAct = new QAction(QIcon(":/themes/"+Theme+"/preferences.png"), tr("&Preferences..."), this); preferencesAct->setStatusTip(tr("Edit general preferences")); connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences())); - checkForUpdatesAct = new QAction(QIcon(":/images/update.png"), tr("&Check for updates..."), this); + checkForUpdatesAct = new QAction(QIcon(":/themes/"+Theme+"/update.png"), tr("&Check for updates..."), this); checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion")); connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates())); - contributorsAct = new QAction(QIcon(":/images/contributors.png"), tr("Contributors &List..."), this); + contributorsAct = new QAction(QIcon(":/themes/"+Theme+"/contributors.png"), tr("Contributors &List..."), this); contributorsAct->setStatusTip(tr("Show Companion contributors list")); connect(contributorsAct, SIGNAL(triggered()), this, SLOT(contributors())); - changelogAct = new QAction(QIcon(":/images/changelog.png"), tr("ChangeLog..."), this); + changelogAct = new QAction(QIcon(":/themes/"+Theme+"/changelog.png"), tr("ChangeLog..."), this); changelogAct->setStatusTip(tr("Show Companion changelog")); connect(changelogAct, SIGNAL(triggered()), this, SLOT(changelog())); - fwchangelogAct = new QAction(QIcon(":/images/changelog.png"), tr("Firmware ChangeLog..."), this); + fwchangelogAct = new QAction(QIcon(":/themes/"+Theme+"/changelog.png"), tr("Firmware ChangeLog..."), this); fwchangelogAct->setStatusTip(tr("Show firmware changelog")); connect(fwchangelogAct, SIGNAL(triggered()), this, SLOT(fwchangelog())); - compareAct = new QAction(QIcon(":/images/compare.png"), tr("Compare..."), this); + compareAct = new QAction(QIcon(":/themes/"+Theme+"/compare.png"), tr("Compare..."), this); compareAct->setStatusTip(tr("Compare models")); compareAct->setEnabled(false); connect(compareAct, SIGNAL(triggered()), this, SLOT(compare())); - customizeSplashAct = new QAction(QIcon(":/images/customize.png"), tr("Customize your &TX..."), this); + customizeSplashAct = new QAction(QIcon(":/themes/"+Theme+"/customize.png"), tr("Customize your &TX..."), this); customizeSplashAct->setStatusTip(tr("Customize the splash screen of your TX")); connect(customizeSplashAct, SIGNAL(triggered()), this, SLOT(customizeSplash())); //! [0] - exitAct = new QAction(QIcon(":/images/exit.png"), tr("E&xit"), this); + exitAct = new QAction(QIcon(":/themes/"+Theme+"/exit.png"), tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); //! [0] - cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this); + cutAct = new QAction(QIcon(":/themes/"+Theme+"/cut.png"), tr("Cu&t"), this); cutAct->setShortcuts(QKeySequence::Cut); cutAct->setStatusTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cutAct, SIGNAL(triggered()), this, SLOT(cut())); - copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this); + copyAct = new QAction(QIcon(":/themes/"+Theme+"/copy.png"), tr("&Copy"), this); copyAct->setShortcuts(QKeySequence::Copy); copyAct->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), this, SLOT(copy())); - pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this); + pasteAct = new QAction(QIcon(":/themes/"+Theme+"/paste.png"), tr("&Paste"), this); pasteAct->setShortcuts(QKeySequence::Paste); pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current " "selection")); connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste())); - burnToAct = new QAction(QIcon(":/images/write_eeprom.png"), tr("&Write Models and Settings To Tx"), this); + burnToAct = new QAction(QIcon(":/themes/"+Theme+"/write_eeprom.png"), tr("&Write Models and Settings To Tx"), this); burnToAct->setShortcut(tr("Ctrl+Alt+W")); burnToAct->setStatusTip(tr("Write Models and Settings to transmitter")); connect(burnToAct,SIGNAL(triggered()),this,SLOT(burnTo())); - burnFromAct = new QAction(QIcon(":/images/read_eeprom.png"), tr("&Read Models and Settings From Tx"), this); + burnFromAct = new QAction(QIcon(":/themes/"+Theme+"/read_eeprom.png"), tr("&Read Models and Settings From Tx"), this); burnFromAct->setShortcut(tr("Ctrl+Alt+R")); burnFromAct->setStatusTip(tr("Read Models and Settings from transmitter")); connect(burnFromAct,SIGNAL(triggered()),this,SLOT(burnFrom())); - burnToFlashAct = new QAction(QIcon(":/images/write_flash.png"), tr("Write Firmware"), this); + burnToFlashAct = new QAction(QIcon(":/themes/"+Theme+"/write_flash.png"), tr("Write Firmware"), this); burnToFlashAct->setStatusTip(tr("Write firmware to transmitter")); connect(burnToFlashAct,SIGNAL(triggered()),this,SLOT(burnToFlash())); - burnExtenalToEEPROMAct = new QAction(QIcon(":/images/write_eeprom_file.png"), tr("Write Models and Settings from file to Tx"), this); + burnExtenalToEEPROMAct = new QAction(QIcon(":/themes/"+Theme+"/write_eeprom_file.png"), tr("Write Models and Settings from file to Tx"), this); burnExtenalToEEPROMAct->setStatusTip(tr("Write Models and Settings from file to transmitter")); connect(burnExtenalToEEPROMAct,SIGNAL(triggered()),this,SLOT(burnExtenalToEEPROM())); - burnExtenalFromEEPROMAct = new QAction(QIcon(":/images/read_eeprom_file.png"), tr("Save transmitter Models and Settings to file"), this); + burnExtenalFromEEPROMAct = new QAction(QIcon(":/themes/"+Theme+"/read_eeprom_file.png"), tr("Save transmitter Models and Settings to file"), this); burnExtenalFromEEPROMAct->setStatusTip(tr("Save the Models and Settings from the transmitter to a file")); connect(burnExtenalFromEEPROMAct,SIGNAL(triggered()),this,SLOT(burnExtenalFromEEPROM())); - burnFromFlashAct = new QAction(QIcon(":/images/read_flash.png"), tr("Read Firmware"), this); + burnFromFlashAct = new QAction(QIcon(":/themes/"+Theme+"/read_flash.png"), tr("Read Firmware"), this); burnFromFlashAct->setStatusTip(tr("Read firmware from transmitter")); connect(burnFromFlashAct,SIGNAL(triggered()),this,SLOT(burnFromFlash())); - burnConfigAct = new QAction(QIcon(":/images/configure.png"), tr("&Configure..."), this); + burnConfigAct = new QAction(QIcon(":/themes/"+Theme+"/configure.png"), tr("&Configure..."), this); burnConfigAct->setStatusTip(tr("Configure software for reading from and writing to the transmitter")); connect(burnConfigAct,SIGNAL(triggered()),this,SLOT(burnConfig())); EEPROMInterface *eepromInterface = GetEepromInterface(); if (!IS_ARM(eepromInterface->getBoard())) { - burnListAct = new QAction(QIcon(":/images/list.png"), tr("&List programmers"), this); + burnListAct = new QAction(QIcon(":/themes/"+Theme+"/list.png"), tr("&List programmers"), this); burnListAct->setStatusTip(tr("List available programmers")); connect(burnListAct,SIGNAL(triggered()),this,SLOT(burnList())); - burnFusesAct = new QAction(QIcon(":/images/fuses.png"), tr("&Fuses..."), this); + burnFusesAct = new QAction(QIcon(":/themes/"+Theme+"/fuses.png"), tr("&Fuses..."), this); burnFusesAct->setStatusTip(tr("Show fuses dialog")); connect(burnFusesAct,SIGNAL(triggered()),this,SLOT(burnFuses())); } - simulateAct = new QAction(QIcon(":/images/simulate.png"), tr("&Simulate"), this); + simulateAct = new QAction(QIcon(":/themes/"+Theme+"/simulate.png"), tr("&Simulate"), this); simulateAct->setShortcut(tr("Alt+S")); simulateAct->setStatusTip(tr("Simulate selected model.")); simulateAct->setEnabled(false); connect(simulateAct,SIGNAL(triggered()),this,SLOT(simulate())); - printAct = new QAction(QIcon(":/images/print.png"), tr("&Print"), this); + printAct = new QAction(QIcon(":/themes/"+Theme+"/print.png"), tr("&Print"), this); printAct->setShortcut(tr("Ctrl+P")); printAct->setStatusTip(tr("Print current model.")); printAct->setEnabled(false); @@ -1766,11 +1775,11 @@ void MainWindow::createActions() separatorAct = new QAction(this); separatorAct->setSeparator(true); - aboutAct = new QAction(QIcon(":/images/information.png"), tr("&About"), this); + aboutAct = new QAction(QIcon(":/themes/"+Theme+"/information.png"), tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - switchLayoutDirectionAct = new QAction(QIcon(":/images/switch_dir.png"), tr("Switch layout direction"), this); + switchLayoutDirectionAct = new QAction(QIcon(":/themes/"+Theme+"/switch_dir.png"), tr("Switch layout direction"), this); switchLayoutDirectionAct->setStatusTip(tr("Switch layout Left/Right")); connect(switchLayoutDirectionAct, SIGNAL(triggered()), this, SLOT(switchLayoutDirection())); for (int i = 0; i < MaxRecentFiles; ++i) { @@ -1800,7 +1809,7 @@ void MainWindow::createMenus() fileMenu->addAction(saveAct); fileMenu->addAction(saveAsAct); fileMenu->addMenu(recentFileMenu); - recentFileMenu->setIcon(QIcon(":/images/recentdocument.png")); + recentFileMenu->setIcon(QIcon(":/themes/"+Theme+"/recentdocument.png")); for ( int i = 0; i < MaxRecentFiles; ++i) recentFileMenu->addAction(recentFileActs[i]); fileMenu->addSeparator(); @@ -1813,7 +1822,7 @@ void MainWindow::createMenus() fileMenu->addAction(preferencesAct); fileMenu->addMenu(profilesMenu); - profilesMenu->setIcon(QIcon(":/images/profiles.png")); + profilesMenu->setIcon(QIcon(":/themes/"+Theme+"/profiles.png")); for ( int i = 0; i < MAX_PROFILES; ++i) profilesMenu->addAction(profileActs[i]); fileMenu->addAction(switchLayoutDirectionAct); @@ -1878,14 +1887,32 @@ QMenu *MainWindow::createProfilesMenu() void MainWindow::createToolBars() { + QSettings settings("companion", "companion"); + int icon_size=settings.value("icon_size",1 ).toInt(); + QSize size; + switch(icon_size) { + case 0: + size=QSize(16,16); + break; + case 1: + size=QSize(24,24); + break; + case 3: + size=QSize(48,48); + break; + default: + size=QSize(32,32); + break; + } fileToolBar = addToolBar(tr("File")); + fileToolBar->setIconSize(size); fileToolBar->setObjectName("File"); fileToolBar->addAction(newAct); fileToolBar->addAction(openAct); QToolButton * recentToolButton = new QToolButton; recentToolButton->setPopupMode(QToolButton::InstantPopup); recentToolButton->setMenu(createRecentFileMenu()); - recentToolButton->setIcon(QIcon(":/images/recentdocument.png")); + recentToolButton->setIcon(QIcon(":/themes/"+Theme+"/recentdocument.png")); recentToolButton->setToolTip(tr("Recent Files")); fileToolBar->addWidget(recentToolButton); fileToolBar->addAction(saveAct); @@ -1895,11 +1922,10 @@ void MainWindow::createToolBars() profileButton = new QToolButton; profileButton->setPopupMode(QToolButton::InstantPopup); profileButton->setMenu(createProfilesMenu()); - profileButton->setIcon(QIcon(":/images/profiles.png")); + profileButton->setIcon(QIcon(":/themes/"+Theme+"/profiles.png")); profileButton->setToolTip(tr("Firmware Profiles")); fileToolBar->addWidget(profileButton); bool notfound=true; - QSettings settings("companion", "companion"); settings.beginGroup("Profiles"); for (int i=0; iaddAction(compareAct); editToolBar = addToolBar(tr("Edit")); + editToolBar->setIconSize(size); editToolBar->setObjectName("Edit"); editToolBar->addAction(cutAct); editToolBar->addAction(copyAct); @@ -1925,6 +1952,7 @@ void MainWindow::createToolBars() burnToolBar = new QToolBar(tr("Write")); addToolBar( Qt::LeftToolBarArea, burnToolBar ); + burnToolBar->setIconSize(size); burnToolBar->setObjectName("Write"); burnToolBar->addAction(burnToAct); burnToolBar->addAction(burnFromAct); @@ -1938,6 +1966,7 @@ void MainWindow::createToolBars() burnToolBar->addAction(burnConfigAct); helpToolBar = addToolBar(tr("Help")); + helpToolBar->setIconSize(size); helpToolBar->setObjectName("Help"); helpToolBar->addAction(checkForUpdatesAct); helpToolBar->addAction(aboutAct); diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h index 300bac507..d26667f75 100644 --- a/companion/src/mainwindow.h +++ b/companion/src/mainwindow.h @@ -138,6 +138,7 @@ private: void updateProfilesActions(); int getFileType(const QString &fullFileName); QString FindTaranisPath(); + QString Theme; QString strippedName(const QString &fullFileName); MdiChild *activeMdiChild(); diff --git a/companion/src/preferencesdialog.cpp b/companion/src/preferencesdialog.cpp index 1e97e5785..b0f59b38d 100644 --- a/companion/src/preferencesdialog.cpp +++ b/companion/src/preferencesdialog.cpp @@ -265,6 +265,8 @@ void preferencesDialog::writeValues() settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked()); settings.setValue("wizardEnable", ui->wizardEnable_ChkB->isChecked()); settings.setValue("show_splash", ui->showSplash->isChecked()); + settings.setValue("theme", ui->theme_CB->currentIndex()); + settings.setValue("icon_size", ui->iconSize_CB->currentIndex()); settings.setValue("simuSW", ui->simuSW->isChecked()); settings.setValue("history_size", ui->historySize->value()); settings.setValue("burnFirmware", ui->burnFirmware->isChecked()); @@ -404,6 +406,8 @@ void preferencesDialog::initSettings() ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool()); ui->wizardEnable_ChkB->setChecked(settings.value("wizardEnable", true).toBool()); ui->showSplash->setChecked(settings.value("show_splash", true).toBool()); + ui->theme_CB->setCurrentIndex(settings.value("theme", 1).toInt()); + ui->iconSize_CB->setCurrentIndex(settings.value("icon_size", 2).toInt()); ui->historySize->setValue(settings.value("history_size", 10).toInt()); ui->backLightColor->setCurrentIndex(settings.value("backLight", 0).toInt()); ui->startupCheck_fw->setChecked(settings.value("startup_check_fw", true).toBool()); diff --git a/companion/src/preferencesdialog.ui b/companion/src/preferencesdialog.ui index 021a38b58..f53946ab0 100644 --- a/companion/src/preferencesdialog.ui +++ b/companion/src/preferencesdialog.ui @@ -7,7 +7,7 @@ 0 0 685 - 710 + 766 @@ -26,7 +26,7 @@ Preferences - + :/images/preferences.png:/images/preferences.png @@ -39,27 +39,57 @@ 4 - - - - - 0 - 0 - - - - Show Splash Screen - - + + + + + + + 40 + 0 + + + + 15 + + + 10 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Ask use of wizard for new models + + + true + + + + - + Qt::Horizontal - + @@ -99,17 +129,7 @@ - - - - Ask use of wizard for new models - - - true - - - - + @@ -161,7 +181,7 @@ ... - + :/images/clear.png:/images/clear.png @@ -171,14 +191,14 @@ - + Remember switches in simulator - + @@ -207,7 +227,7 @@ - + 6 @@ -228,7 +248,7 @@ ... - + :/images/library.png:/images/library.png @@ -248,33 +268,27 @@ - - + + - - - - true + Simulator capture folder - - + + - - 40 + + 0 0 - - 15 - - - 10 + + Language (requires restart) - + @@ -418,7 +432,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -431,7 +445,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -459,7 +473,7 @@ This is used by the templated to determine which channel goes to what number out - + 1 @@ -483,7 +497,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -507,7 +521,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -520,7 +534,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -563,7 +577,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -590,7 +604,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -638,20 +652,7 @@ This is used by the templated to determine which channel goes to what number out - - - - - 0 - 0 - - - - Language (requires restart) - - - - + 1 @@ -682,7 +683,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -695,7 +696,7 @@ This is used by the templated to determine which channel goes to what number out - + @@ -711,7 +712,7 @@ This is used by the templated to determine which channel goes to what number out - + Mode selection: @@ -759,7 +760,7 @@ Mode 4: - + @@ -772,57 +773,21 @@ Mode 4: - - - - - 0 - 0 - - - - - Include companion splashes - - - - - Only user defined splashes - - - - - - - - - 0 - 0 - - - - Splash library behaviour - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Profile slot - + Automatic Backup Folder - + @@ -847,7 +812,7 @@ Mode 4: - + Qt::Vertical @@ -863,7 +828,7 @@ Mode 4: - + @@ -890,7 +855,7 @@ Mode 4: - + QLayout::SetMaximumSize @@ -981,7 +946,7 @@ May be different from firmware language - + @@ -1021,13 +986,6 @@ May be different from firmware language - - - - Simulator capture folder - - - @@ -1041,14 +999,14 @@ May be different from firmware language - + Qt::Horizontal - + QLayout::SetMaximumSize @@ -1601,7 +1559,7 @@ May be different from firmware language - + @@ -1619,13 +1577,154 @@ May be different from firmware language - + Google Earth Executable + + + + + 0 + 0 + + + + Show Splash At Start + + + + + + + + 0 + 0 + + + + Splash library behaviour + + + + + + + + 0 + 0 + + + + + Include companion splashes + + + + + Only user defined splashes + + + + + + + + + + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Theme + + + + + + + + Classic + + + + + Monochrome + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Icon size + + + + + + + + Small + + + + + Normal + + + + + Big + + + + + Huge + + + + + +