From ea57e3e40a0a2a1eaa4b15f44665744550e9bba3 Mon Sep 17 00:00:00 2001 From: Kjell Kernen Date: Fri, 21 Feb 2014 17:29:02 +0100 Subject: [PATCH 1/3] Corrected a number of smaller issuses in the GUI. A new profile now keeps the values from the current profile. Removed the special handling of the Name field in profiles. --- companion/src/appdata.cpp | 78 ++++++++++----- companion/src/appdata.h | 45 ++++----- companion/src/apppreferencesdialog.ui | 19 +++- companion/src/burndialog.cpp | 2 +- companion/src/customizesplashdialog.cpp | 4 +- companion/src/mainwindow.cpp | 93 +++++++++--------- companion/src/mdichild.cpp | 2 +- .../themes/monochrome/24/fwpreferences.png | Bin 274 -> 286 bytes .../themes/monochrome/32/fwpreferences.png | Bin 409 -> 341 bytes .../themes/monochrome/48/fwpreferences.png | Bin 462 -> 460 bytes 10 files changed, 141 insertions(+), 102 deletions(-) diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index a0f1fbb1c..09b1ca66f 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -280,35 +280,31 @@ void JStickData::flush() // ** Profile class******************** // Get declarations -QString Profile::firmware() { return _firmware; } -QString Profile::name() { return _name; } -QString Profile::sdPath() { return _sdPath; } -QString Profile::splashFile() { return _splashFile; } -bool Profile::burnFirmware() { return _burnFirmware; } -bool Profile::renameFwFiles() { return _renameFwFiles; } -bool Profile::patchImage() { return _patchImage; } -int Profile::channelOrder() { return _channelOrder; } -int Profile::defaultMode() { return _defaultMode; } +QString Profile::firmware() const { return _firmware; } +QString Profile::name() const { return _name; } +QString Profile::sdPath() const { return _sdPath; } +QString Profile::splashFile() const { return _splashFile; } +bool Profile::burnFirmware() const { return _burnFirmware; } +bool Profile::renameFwFiles() const { return _renameFwFiles; } +bool Profile::patchImage() const { return _patchImage; } +int Profile::channelOrder() const { return _channelOrder; } +int Profile::defaultMode() const { return _defaultMode; } -QString Profile::beeper() { return _beeper; } -QString Profile::countryCode() { return _countryCode; } -QString Profile::display() { return _display; } -QString Profile::haptic() { return _haptic; } -QString Profile::speaker() { return _speaker; } -QString Profile::stickPotCalib() { return _stickPotCalib; } -QString Profile::trainerCalib() { return _trainerCalib; } -int Profile::currentCalib() { return _currentCalib; } -int Profile::gsStickMode() { return _gsStickMode; } -int Profile::ppmMultiplier() { return _ppmMultiplier; } -int Profile::vBatCalib() { return _vBatCalib; } -int Profile::vBatWarn() { return _vBatWarn; } +QString Profile::beeper() const { return _beeper; } +QString Profile::countryCode() const { return _countryCode; } +QString Profile::display() const { return _display; } +QString Profile::haptic() const { return _haptic; } +QString Profile::speaker() const { return _speaker; } +QString Profile::stickPotCalib() const { return _stickPotCalib; } +QString Profile::trainerCalib() const { return _trainerCalib; } +int Profile::currentCalib() const { return _currentCalib; } +int Profile::gsStickMode() const { return _gsStickMode; } +int Profile::ppmMultiplier() const { return _ppmMultiplier; } +int Profile::vBatCalib() const { return _vBatCalib; } +int Profile::vBatWarn() const { return _vBatWarn; } // Set declarations -void Profile::name (const QString x) { if (x.isEmpty()) // Name may never be empty! - store("----", _name, "Name", "Profiles", QString("profile%1").arg(index)); -else - store(x, _name, "Name", "Profiles", QString("profile%1").arg(index));} - +void Profile::name (const QString x) { store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));} void Profile::firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));} void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));} @@ -337,6 +333,34 @@ Profile::Profile() index = -1; } +// The default copy operator can not be used since the index variable would be destroyed +Profile& Profile::operator=(const Profile& rhs) +{ + _name = rhs.name(); + _firmware = rhs.firmware(); + _sdPath = rhs.sdPath(); + _splashFile = rhs.splashFile(); + _burnFirmware = rhs.burnFirmware(); + _renameFwFiles = rhs.renameFwFiles(); + _patchImage = rhs.patchImage(); + _channelOrder = rhs.channelOrder(); + _defaultMode = rhs.defaultMode(); + _beeper = rhs.beeper(); + _countryCode = rhs.countryCode(); + _display = rhs.display(); + _haptic = rhs.haptic(); + _speaker = rhs.speaker(); + _stickPotCalib = rhs.stickPotCalib(); + _trainerCalib = rhs.trainerCalib(); + _currentCalib = rhs.currentCalib(); + _gsStickMode = rhs.gsStickMode(); + _ppmMultiplier = rhs.ppmMultiplier(); + _vBatCalib = rhs.vBatCalib(); + _vBatWarn = rhs.vBatWarn(); + + return *this; +} + void Profile::remove() { // Remove all profile values from settings file @@ -400,7 +424,7 @@ void Profile::flush() { // Load and store all variables. Use default values if setting values are missing getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _name, "Name" ,"----" ,"Profiles", QString("profile%1").arg(index)); + getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); diff --git a/companion/src/appdata.h b/companion/src/appdata.h index c8c85a151..210b8ae8f 100644 --- a/companion/src/appdata.h +++ b/companion/src/appdata.h @@ -1,4 +1,4 @@ -// Companion Application Data Class Definition. +// Companion Application Data Class Declaration. // Author Kjell Kernen // All temporary and permanent global variables are defined here to make @@ -118,28 +118,28 @@ class Profile: protected CompStoreObj public: // All the get definitions - QString firmware(); - QString name(); - QString sdPath(); - QString splashFile(); - bool burnFirmware(); - bool renameFwFiles(); - bool patchImage(); - int channelOrder(); - int defaultMode(); + QString firmware() const; + QString name() const; + QString sdPath() const; + QString splashFile() const; + bool burnFirmware() const; + bool renameFwFiles() const; + bool patchImage() const; + int channelOrder() const; + int defaultMode() const; - QString beeper(); - QString countryCode(); - QString display(); - QString haptic(); - QString speaker(); - QString stickPotCalib(); - QString trainerCalib(); - int currentCalib(); - int gsStickMode(); - int ppmMultiplier(); - int vBatCalib(); - int vBatWarn(); + QString beeper() const; + QString countryCode() const; + QString display() const; + QString haptic() const; + QString speaker() const; + QString stickPotCalib() const; + QString trainerCalib() const; + int currentCalib() const; + int gsStickMode() const; + int ppmMultiplier() const; + int vBatCalib() const; + int vBatWarn() const; // All the set definitions void name (const QString); @@ -166,6 +166,7 @@ class Profile: protected CompStoreObj void vBatWarn (const int); Profile(); + Profile& operator=(const Profile&); void remove(); bool existsOnDisk(); void init(int newIndex); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index c15874915..952881a7e 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -26,12 +26,21 @@ Edit Settings + + 6 + + + 6 + + + 6 + + + 6 + 2 - - 6 - @@ -490,7 +499,7 @@ - Radio Settings + Radio Settings Profile @@ -720,7 +729,7 @@ This is used by the templated to determine which channel goes to what number out - Settings Profile + Profile Name diff --git a/companion/src/burndialog.cpp b/companion/src/burndialog.cpp index e7f48e0b3..cb56b5881 100644 --- a/companion/src/burndialog.cpp +++ b/companion/src/burndialog.cpp @@ -140,7 +140,7 @@ void burnDialog::on_FlashLoadButton_clicked() ui->EEbackupCB->hide(); QTimer::singleShot(0, this, SLOT(shrink())); if (hexType==2) { - fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER); + fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER); checkFw(fileName); } else { diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp index b4d901836..748c48b69 100644 --- a/companion/src/customizesplashdialog.cpp +++ b/companion/src/customizesplashdialog.cpp @@ -182,10 +182,10 @@ void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);} void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);} void customizeSplashDialog::loadFirmware(Side side) { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER); if (!fileName.isEmpty()) { if (!side.displayImage( fileName, FW )) - QMessageBox::critical(this, tr("Error"), tr("Cannot load embedded FW image from %1.").arg(fileName)); + QMessageBox::critical(this, tr("Error"), tr("Can not load embedded image from firmware file %1.").arg(fileName)); else g.flashDir( QFileInfo(fileName).dir().absolutePath() ); } diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 75d68038b..f38bfcbc7 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -642,7 +642,7 @@ void MainWindow::openDocURL() void MainWindow::openFile() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.eepromDir(), tr(EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Models and Settings file"), g.eepromDir(), tr(EEPROM_FILES_FILTER)); if (!fileName.isEmpty()) { g.eepromDir(QFileInfo(fileName).dir().absolutePath()); @@ -1586,17 +1586,17 @@ void MainWindow::createActions() } updateProfilesActions(); - newAct = addAct("new.png", tr("New"), tr("Create a new file"), QKeySequence::New, SLOT(newFile())); - openAct = addAct("open.png", tr("Open..."), tr("Open an existing file"), QKeySequence::Open, SLOT(openFile())); - saveAct = addAct("save.png", tr("Save..."), tr("Save the document to disk"), QKeySequence::Save, SLOT(save())); - saveAsAct = addAct("saveas.png", tr("Save As..."), tr("Save the document to disk"), QKeySequence::SaveAs, SLOT(saveAs())); - exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(newFile())); - cutAct = addAct("cut.png", tr("Cut"), tr("Cut current selection to the clipboard"), QKeySequence::Cut, SLOT(cut())); - copyAct = addAct("copy.png", tr("Copy..."), tr("Copy current selection to the clipboard"), QKeySequence::Copy, SLOT(copy())); - pasteAct = addAct("paste.png", tr("Paste..."), tr("Paste clipboard into current selection"), QKeySequence::Paste, SLOT(paste())); + newAct = addAct("new.png", tr("New Models+Settings"), tr("Create a new Models and Settings file"), QKeySequence::New, SLOT(newFile())); + openAct = addAct("open.png", tr("Open Models+Settings..."), tr("Open Models and Settings file"), QKeySequence::Open, SLOT(openFile())); + saveAct = addAct("save.png", tr("Save Models+Settings..."), tr("Save Models and Settings file"), QKeySequence::Save, SLOT(save())); + saveAsAct = addAct("saveas.png", tr("Save Models+Settings as..."), tr("Save Models and Settings file"), QKeySequence::SaveAs, SLOT(saveAs())); + exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(newFile())); + cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut())); + copyAct = addAct("copy.png", tr("Copy Model..."), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy())); + pasteAct = addAct("paste.png", tr("Paste Model..."), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste())); QActionGroup *themeAlignGroup = new QActionGroup(this); - classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classical Companion icon theme"), SLOT(setClassicTheme())); + classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classic companion9x icon theme"), SLOT(setClassicTheme())); yericoThemeAct = addAct( themeAlignGroup, tr("Yerico"), tr("Yellow round honey sweet icon theme"), SLOT(setYericoTheme())); monoThemeAct = addAct( themeAlignGroup, tr("Monochrome"), tr("A monochrome black icon theme"), SLOT(setMonochromeTheme())); monoWhiteAct = addAct( themeAlignGroup, tr("MonoWhite"), tr("A monochrome white icon theme"), SLOT(setMonoWhiteTheme())); @@ -1622,30 +1622,30 @@ void MainWindow::createActions() swedishLangAct = addAct( langAlignGroup, tr("Swedish"), tr("Use Swedish in menus"), SLOT(setSELanguage())); russianLangAct = addAct( langAlignGroup, tr("Russian"), tr("Use Russian in menus"), SLOT(setRULanguage())); - aboutAct = addAct("information.png", tr("About"), tr("Show the application's About box"), SLOT(about())); - printAct = addAct("print.png", tr("Print"), tr("Print current model"), SLOT(print())); - simulateAct = addAct("simulate.png", tr("Simulate"), tr("Simulate selected model"), SLOT(simulate())); - loadbackupAct = addAct("open.png", tr("loadBackup..."), tr("Load backup from file"), SLOT(loadBackup())); - logsAct = addAct("logs.png", tr("Logs"), tr("Open log file"), SLOT(logFile())); - appPrefsAct = addAct("apppreferences.png",tr("Setting..."), tr("Edit Settings"), SLOT(appPrefs())); - fwPrefsAct = addAct("fwpreferences.png", tr("Downloads..."), tr("Download firmware and voice files"), SLOT(fwPrefs())); - checkForUpdatesAct = addAct("update.png", tr("Check for updates..."), tr("Check OpenTX and Companion updates"), SLOT(doUpdates())); - changelogAct = addAct("changelog.png", tr("ChangeLog..."), tr("Show Companion changelog"), SLOT(changelog())); - fwchangelogAct = addAct("changelog.png", tr("Firmware ChangeLog..."), tr("Show firmware changelog"), SLOT(fwchangelog())); - compareAct = addAct("compare.png", tr("Compare..."), tr("Compare models"), SLOT(compare())); - editSplashAct = addAct("paintbrush.png", tr("Edit Tx Splash Image..."),tr("edit the splash screen of your TX"), SLOT(customizeSplash())); - burnListAct = addAct("list.png", tr("List programmers"), tr("List available programmers"), SLOT(burnList())); - burnFusesAct = addAct("fuses.png", tr("Fuses..."), tr("Show fuses dialog"), SLOT(burnFuses())); - readFlashAct = addAct("read_flash.png", tr("Read Firmware"), tr("Read firmware from transmitter"), SLOT(readFlash())); - writeFlashAct = addAct("write_flash.png", tr("Write Firmware"), tr("Write firmware to transmitter"), SLOT(writeFlash())); - createProfileAct = addAct("", tr("New Profile"), tr("Create a new Radio Setting Profile"), SLOT(createProfile())); + aboutAct = addAct("information.png", tr("About..."), tr("Show the application's About box"), SLOT(about())); + printAct = addAct("print.png", tr("Print..."), tr("Print current model"), SLOT(print())); + simulateAct = addAct("simulate.png", tr("Simulate..."), tr("Simulate current model"), SLOT(simulate())); + loadbackupAct = addAct("open.png", tr("Load Backup..."), tr("Load backup from file"), SLOT(loadBackup())); + logsAct = addAct("logs.png", tr("View Log File..."), tr("Open and view log file"), SLOT(logFile())); + appPrefsAct = addAct("apppreferences.png",tr("Settings..."), tr("Edit Settings"), SLOT(appPrefs())); + fwPrefsAct = addAct("fwpreferences.png", tr("Download..."), tr("Download firmware and voice files"), SLOT(fwPrefs())); + checkForUpdatesAct = addAct("update.png", tr("Check for Updates..."), tr("Check OpenTX and Companion updates"), SLOT(doUpdates())); + changelogAct = addAct("changelog.png", tr("Companion Changes..."), tr("Show Companion change log"), SLOT(changelog())); + fwchangelogAct = addAct("changelog.png", tr("Firmware Changes..."), tr("Show firmware change log"), SLOT(fwchangelog())); + compareAct = addAct("compare.png", tr("Compare Models..."), tr("Compare models"), SLOT(compare())); + editSplashAct = addAct("paintbrush.png", tr("Edit Tx Splash Image..."), tr("Edit the splash image of your TX"), SLOT(customizeSplash())); + burnListAct = addAct("list.png", tr("List programmers..."), tr("List available programmers"), SLOT(burnList())); + burnFusesAct = addAct("fuses.png", tr("Fuses..."), tr("Show fuses dialog"), SLOT(burnFuses())); + readFlashAct = addAct("read_flash.png", tr("Read Firmware"), tr("Read firmware from transmitter"), SLOT(readFlash())); + writeFlashAct = addAct("write_flash.png", tr("Write Firmware"), tr("Write firmware to transmitter"), SLOT(writeFlash())); + createProfileAct = addAct("", tr("Add Radio Profile"), tr("Create a new Radio Setting Profile"), SLOT(createProfile())); openDocURLAct = addAct("", tr("Manuals and other Documents"), tr("Open the OpenTX document page in a web browser"), SLOT(openDocURL())); writeEepromAct = addAct("write_eeprom.png", tr("Write Models and Settings To Tx"), tr("Write Models and Settings to transmitter"), SLOT(writeEeprom())); readEepromAct = addAct("read_eeprom.png", tr("Read Models and Settings From Tx"), tr("Read Models and Settings from transmitter"), SLOT(readEeprom())); - burnConfigAct = addAct("configure.png", tr("Configure connection software..."), tr("Configure software for reading from and writing to the transmitter"), SLOT(burnConfig())); - writeFileToEepromAct = addAct("write_eeprom_file.png", tr("Write Models and Settings from file to Tx"), tr("Write Models and Settings from file to transmitter"), SLOT(writeFileToEeprom())); - readEepromToFileAct = addAct("read_eeprom_file.png", tr("Save Tx Models and Settings to file"), tr("Save the Models and Settings from the transmitter to a file"), SLOT(readEepromToFile())); - contributorsAct = addAct("contributors.png", tr("Contributors"), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors())); + burnConfigAct = addAct("configure.png", tr("Configure Communications..."), tr("Configure software for communicating with the transmitter"), SLOT(burnConfig())); + writeFileToEepromAct = addAct("write_eeprom_file.png", tr("Write Models and Settings from file to Tx"), tr("Write Models and Settings from file to transmitter"), SLOT(writeFileToEeprom())); + readEepromToFileAct = addAct("read_eeprom_file.png", tr("Save Tx Models and Settings to file"), tr("Save the Models and Settings from the transmitter to a file"), SLOT(readEepromToFile())); + contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors())); compareAct->setEnabled(false); simulateAct->setEnabled(false); @@ -1655,7 +1655,7 @@ void MainWindow::createActions() void MainWindow::createMenus() { - QMenu *recentFileMenu=new QMenu(tr("Recent Files")); + QMenu *recentFileMenu=new QMenu(tr("Recent Models+Settings")); QMenu *languageMenu=new QMenu(tr("Set Menu Language")); QMenu *themeMenu=new QMenu(tr("Set Icon Theme")); QMenu *iconThemeSizeMenu=new QMenu(tr("Set Icon Size")); @@ -1671,13 +1671,12 @@ void MainWindow::createMenus() recentFileMenu->addAction(recentFileActs[i]); fileMenu->addSeparator(); fileMenu->addAction(logsAct); + fileMenu->addAction(fwPrefsAct); fileMenu->addSeparator(); fileMenu->addAction(simulateAct); fileMenu->addAction(printAct); fileMenu->addAction(compareAct); fileMenu->addSeparator(); - fileMenu->addAction(fwPrefsAct); - fileMenu->addMenu(createProfilesMenu()); fileMenu->addAction(exitAct); editMenu = menuBar()->addMenu(tr("Edit")); @@ -1713,6 +1712,7 @@ void MainWindow::createMenus() iconThemeSizeMenu->addAction(hugeIconAct); settingsMenu->addSeparator(); settingsMenu->addAction(appPrefsAct); + settingsMenu->addMenu(createProfilesMenu()); settingsMenu->addAction(editSplashAct); settingsMenu->addAction(burnConfigAct); @@ -1756,7 +1756,7 @@ QMenu *MainWindow::createRecentFileMenu() QMenu *MainWindow::createProfilesMenu() { - QMenu *profilesMenu=new QMenu(tr("Radio Settings Profiles")); + QMenu *profilesMenu=new QMenu(tr("Radio Settings Profile")); int i; for ( i = 0; i < MAX_PROFILES; ++i) { profilesMenu->addAction(profileActs[i]); @@ -1798,25 +1798,26 @@ void MainWindow::createToolBars() recentToolButton->setPopupMode(QToolButton::InstantPopup); recentToolButton->setMenu(createRecentFileMenu()); recentToolButton->setIcon(CompanionIcon("recentdocument.png")); - recentToolButton->setToolTip(tr("Recent Files")); - recentToolButton->setStatusTip(tr("Show a selection list of recent documents")); + recentToolButton->setToolTip(tr("Recent Models+Settings")); + recentToolButton->setStatusTip(tr("Show recent Models+Settings documents")); fileToolBar->addWidget(recentToolButton); fileToolBar->addAction(saveAct); + fileToolBar->addSeparator(); fileToolBar->addAction(logsAct); + fileToolBar->addAction(fwPrefsAct); fileToolBar->addSeparator(); fileToolBar->addAction(appPrefsAct); - fileToolBar->addAction(fwPrefsAct); - fileToolBar->addAction(editSplashAct); QToolButton * profileButton = new QToolButton; profileButton->setPopupMode(QToolButton::InstantPopup); profileButton->setMenu(createProfilesMenu()); profileButton->setIcon(CompanionIcon("profiles.png")); - profileButton->setToolTip(tr("Radio Profiles")); + profileButton->setToolTip(tr("Radio Settings Profile")); profileButton->setStatusTip(tr("Show a selection list of radio settings profiles")); fileToolBar->addWidget(profileButton); + fileToolBar->addAction(editSplashAct); fileToolBar->addSeparator(); fileToolBar->addAction(simulateAct); fileToolBar->addAction(printAct); @@ -1962,9 +1963,9 @@ void MainWindow::updateProfilesActions() { for (int i=0; isetText(text); profileActs[i]->setData(i); profileActs[i]->setVisible(true); @@ -1985,10 +1986,14 @@ void MainWindow::createProfile() if (i==MAX_PROFILES) //Failed to find free slot return; - // Create profile name and force a flush to file - g.profile[i].name( QString("profile%1").arg(i)); + // Create profile by forcing it to write to disk g.profile[i].flush(); + // Copy current profile to new and give it a new name + g.profile[i] = g.profile[g.id()]; + g.profile[i].name( QString("New Radio")); + + g.id(i); updateMenus(); } diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index cd8b49286..72a8f7693 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -649,7 +649,7 @@ void MdiChild::setEEpromAvail(int eavail) bool MdiChild::loadBackup() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.eepromDir(),tr(EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open backup Models and Settings file"), g.eepromDir(),tr(EEPROM_FILES_FILTER)); if (fileName.isEmpty()) return false; QFile file(fileName); diff --git a/companion/src/themes/monochrome/24/fwpreferences.png b/companion/src/themes/monochrome/24/fwpreferences.png index 1f4d9bf0579226539f662e4014a0dbbc63d5af81..2d322e73d92c826c72bda2e80b0ccc3c3e6ac8e6 100644 GIT binary patch delta 211 zcmV;^04)EK0-gepQ-2i=?lj0Gay?~y>$-(=N@}f< z_a4lQ5CVGdqB=1E0F5yy#)vV7xCQ|6?uVm3St7}G-F_(D=w027IujFrqE^&%nT-jmH8FEEbY%!A}MT23{-{a5FG4{Gf&f z{}~t<9%HfKAp--$KT0gH#bPKfY)5V?OCZAVWJ;5AD;~o;s6drpR$?)H4Yf1nDI~*B z(<l!1Xkd`Q%2|EXo((60|@4glKbOnG&P%EbTx002ovPDHLkV1g;9 BQFj0U diff --git a/companion/src/themes/monochrome/32/fwpreferences.png b/companion/src/themes/monochrome/32/fwpreferences.png index ad10a252c377f917140c42df93d2fc753f53485f..17d781fb30687074d25a14254802defdf57875e7 100644 GIT binary patch delta 267 zcmV+m0rdWv1JweMQ-2i{UL_ikEiaCj>+x zuQ(og*VP2_%FriH4VN3f$&ko>lJ{h9AQ>Sb(Yam)y!3$&Ab+(8NOg_^x)2U1;ARnU z*Tl-V1F|XwoDBl5LS*ljHynV*Kq^C4-snAEk$oZT3}UiS57!B3EiSY=CnySwfMTvE zyfl!PbC2;_kk^hgV=^u}{&$@32mbvr;Z%WI+QQ(CwHsJ}0>?R=*sxxF0Nbl~H7$rb RjQ{`u07*qoLfFGf(8OUHMw^IPOum7Cw~M8pRHa;fCO$V$*rR!2W1bjf0f8rjHDX;rfWCo1 z&v21D5eR{H4uR`vtakze%z^Wi{$?~rsuuW83GtKCm-U=8PXF!QWwaS^=DG|CfJF)6 z7r<3jwbX410(*B=7leZ~!r%K+)jkvm|L9v;{$>#V9oY5lY;gb#bA%s7W4$C^UB=t0 z>eVY6z$793B<1|z9T&iFY_GrEwDa~&RJ4Ua$JR$|?gX#EF|ZH3pd@2@*($!}(wjLI g*meO$QIu*~0=c&eUjR3<{r~^~07*qoM6N<$f^7S%$N&HU delta 388 zcmV-~0ek+;1I`1GQ-1~z3@fl6Dlz~70b5B#K~!ko?U^A@!$25@AIJhB(-R2n5(ES_ zLxPzgI1C{O90ogwncy!>%-|3R42B!>y#NUC4s4bH=m2jyX2=_W0MEci0f05&Dd#8V6+nR70suD-Ys5Q% z09OtG1II-k1Rw%Va{wI2wdw!__y&3@{kw6E)D7^FV&XHUFYCEr+WEJ4SJ9@xUg#Lo z2WAzRp8kpRgynPafwg@=$HHgoh;2zil)`2@rCY^HqXC>Nv i+1;oCG#$WXDyctK>I!M0;ufF)0000 Date: Fri, 21 Feb 2014 20:49:00 +0100 Subject: [PATCH 2/3] Fixed setting conversion and initialization problems --- companion/src/appdata.cpp | 632 ++++++++++++++++++----------------- companion/src/mainwindow.cpp | 5 +- 2 files changed, 324 insertions(+), 313 deletions(-) diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index 09b1ca66f..21145f978 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -9,201 +9,201 @@ AppData g; // ** CompStoreObj class******************** void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3) { - QSettings settings(PRODUCT, COMPANY); - if (tag2.isEmpty()) - { - settings.remove(tag1); - } - else if (tag3.isEmpty()) - { - settings.beginGroup(tag1); - settings.remove(tag2); - settings.endGroup(); - } - else - { - settings.beginGroup(tag1); - settings.beginGroup(tag2); - settings.remove(tag3); - settings.endGroup(); - settings.endGroup(); - } + QSettings settings(PRODUCT, COMPANY); + if (tag2.isEmpty()) + { + settings.remove(tag1); + } + else if (tag3.isEmpty()) + { + settings.beginGroup(tag1); + settings.remove(tag2); + settings.endGroup(); + } + else + { + settings.beginGroup(tag1); + settings.beginGroup(tag2); + settings.remove(tag3); + settings.endGroup(); + settings.endGroup(); + } } void CompStoreObj::store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newArray); - array = newArray; + settings.setValue(tag, newArray); + array = newArray; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newSList); - stringList = newSList; + settings.setValue(tag, newSList); + stringList = newSList; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const QString newString, QString &string, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newString); - string = newString; + settings.setValue(tag, newString); + string = newString; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const bool newTruth, bool &truth, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newTruth); - truth = newTruth; + settings.setValue(tag, newTruth); + truth = newTruth; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const int newNumber, int &number, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newNumber); - number = newNumber; + settings.setValue(tag, newNumber); + number = newNumber; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } // Retrieval functions void CompStoreObj::retrieve( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - array = settings.value(tag, def).toByteArray(); + array = settings.value(tag, def).toByteArray(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - stringList = settings.value(tag, def).toStringList(); + stringList = settings.value(tag, def).toStringList(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( QString &string, const QString tag, const QString def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - string = settings.value(tag, def).toString(); + string = settings.value(tag, def).toString(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - truth = settings.value(tag, def).toBool(); + truth = settings.value(tag, def).toBool(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( int &number, const QString tag, const int def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - number = settings.value(tag, def).toInt(); + number = settings.value(tag, def).toInt(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } // Retrieve and Store functions void CompStoreObj::getset( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 ) { - retrieve( array, tag, def, group1, group2); - store(array, array, tag, group1, group2); + retrieve( array, tag, def, group1, group2); + store(array, array, tag, group1, group2); } void CompStoreObj::getset( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 ) { - retrieve( stringList, tag, def, group1, group2); - store(stringList, stringList, tag, group1, group2); + retrieve( stringList, tag, def, group1, group2); + store(stringList, stringList, tag, group1, group2); } void CompStoreObj::getset( QString &string, const QString tag, const QString def, const QString group1, const QString group2 ) { - retrieve( string, tag, def, group1, group2); - store(string, string, tag, group1, group2); + retrieve( string, tag, def, group1, group2); + store(string, string, tag, group1, group2); } void CompStoreObj::getset( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 ) { - retrieve( truth, tag, def, group1, group2); - store(truth, truth, tag, group1, group2); + retrieve( truth, tag, def, group1, group2); + store(truth, truth, tag, group1, group2); } void CompStoreObj::getset( int &number, const QString tag, const int def, const QString group1, const QString group2 ) { - retrieve( number, tag, def, group1, group2); - store(number, number, tag, group1, group2); + retrieve( number, tag, def, group1, group2); + store(number, number, tag, group1, group2); } // ** FwRevision class******************** int FwRevision::get( const QString fwName ) { - QString result; - retrieve( result, fwName, "", "FwRevisions" ); - return result.toInt(); + QString result; + retrieve( result, fwName, "", "FwRevisions" ); + return result.toInt(); } void FwRevision::set( const QString fwName, const int fwRevision ) { - QString tempString= QString("%1").arg(fwRevision); - store( tempString, tempString, fwName, "FwRevisions" ); + QString tempString= QString("%1").arg(fwRevision); + store( tempString, tempString, fwName, "FwRevisions" ); } void FwRevision::remove( const QString tag ) { - clear( "FwRevisions", tag ); + clear( "FwRevisions", tag ); } // ** JStickData class******************** @@ -224,58 +224,58 @@ void JStickData::stick_inv(const int it) { store( it, _stickInv, QString("stick% // Constructor JStickData::JStickData() { - index = -1; + index = -1; } void JStickData::remove() { - // Remove all JStickData values from settings file - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup( "JsCalibration" ); - settings.remove( QString( "stick%1_axe").arg(index) ); - settings.remove( QString( "stick%1_min").arg(index) ); - settings.remove( QString( "stick%1_med").arg(index) ); - settings.remove( QString( "stick%1_max").arg(index) ); - settings.remove( QString( "stick%1_inv").arg(index) ); - settings.endGroup(); + // Remove all JStickData values from settings file + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup( "JsCalibration" ); + settings.remove( QString( "stick%1_axe").arg(index) ); + settings.remove( QString( "stick%1_min").arg(index) ); + settings.remove( QString( "stick%1_med").arg(index) ); + settings.remove( QString( "stick%1_max").arg(index) ); + settings.remove( QString( "stick%1_inv").arg(index) ); + settings.endGroup(); - // Reset all JStickData variables to initial values - init(index); + // Reset all JStickData variables to initial values + init(index); } bool JStickData::existsOnDisk() { - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("JsCalibration"); - int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt(); - settings.endGroup(); + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("JsCalibration"); + int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt(); + settings.endGroup(); - return (axe > -1); + return (axe > -1); } void JStickData::init(int newIndex) { - index = newIndex; - _stickAxe = -1; - _stickMin = -32767; - _stickMed = 0; - _stickMax = 0; - _stickInv = 0; + index = newIndex; + _stickAxe = -1; + _stickMin = -32767; + _stickMed = 0; + _stickMax = 0; + _stickInv = 0; - // Do not write empty joystick calibrations to disk. - if ( !existsOnDisk() ) - return; + // Do not write empty joystick calibrations to disk. + if ( !existsOnDisk() ) + return; - flush(); + flush(); } void JStickData::flush() { - getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); - getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); - getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" ); - getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" ); - getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); + getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); + getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); + getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" ); + getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" ); + getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); } // ** Profile class******************** @@ -330,121 +330,121 @@ void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWa // Constructor Profile::Profile() { - index = -1; + index = -1; } // The default copy operator can not be used since the index variable would be destroyed Profile& Profile::operator=(const Profile& rhs) { - _name = rhs.name(); - _firmware = rhs.firmware(); - _sdPath = rhs.sdPath(); - _splashFile = rhs.splashFile(); - _burnFirmware = rhs.burnFirmware(); - _renameFwFiles = rhs.renameFwFiles(); - _patchImage = rhs.patchImage(); - _channelOrder = rhs.channelOrder(); - _defaultMode = rhs.defaultMode(); - _beeper = rhs.beeper(); - _countryCode = rhs.countryCode(); - _display = rhs.display(); - _haptic = rhs.haptic(); - _speaker = rhs.speaker(); - _stickPotCalib = rhs.stickPotCalib(); - _trainerCalib = rhs.trainerCalib(); - _currentCalib = rhs.currentCalib(); - _gsStickMode = rhs.gsStickMode(); - _ppmMultiplier = rhs.ppmMultiplier(); - _vBatCalib = rhs.vBatCalib(); - _vBatWarn = rhs.vBatWarn(); - + name ( rhs.name() ); + firmware ( rhs.firmware() ); + sdPath ( rhs.sdPath() ); + splashFile ( rhs.splashFile() ); + burnFirmware ( rhs.burnFirmware() ); + renameFwFiles( rhs.renameFwFiles() ); + patchImage ( rhs.patchImage() ); + channelOrder ( rhs.channelOrder() ); + defaultMode ( rhs.defaultMode() ); + beeper ( rhs.beeper() ); + countryCode ( rhs.countryCode() ); + display ( rhs.display() ); + haptic ( rhs.haptic() ); + speaker ( rhs.speaker() ); + stickPotCalib( rhs.stickPotCalib() ); + trainerCalib ( rhs.trainerCalib() ); + currentCalib ( rhs.currentCalib() ); + gsStickMode ( rhs.gsStickMode() ); + ppmMultiplier( rhs.ppmMultiplier() ); + vBatCalib ( rhs.vBatCalib() ); + vBatWarn ( rhs.vBatWarn() ); + return *this; } void Profile::remove() { - // Remove all profile values from settings file - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("Profiles"); - settings.remove(QString("profile%1").arg(index)); - settings.endGroup(); + // Remove all profile values from settings file + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("Profiles"); + settings.remove(QString("profile%1").arg(index)); + settings.endGroup(); - // Reset all profile variables to initial values - init(index); + // Reset all profile variables to initial values + init(index); } bool Profile::existsOnDisk() { - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("Profiles"); - settings.beginGroup(QString("profile%1").arg(index)); - QStringList keyList = settings.allKeys(); - settings.endGroup(); - settings.endGroup(); + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("Profiles"); + settings.beginGroup(QString("profile%1").arg(index)); + QStringList keyList = settings.allKeys(); + settings.endGroup(); + settings.endGroup(); - return (keyList.length() > 0); + return (keyList.length() > 0); } void Profile::init(int newIndex) { - index = newIndex; + index = newIndex; - _firmware = ""; - _name = ""; - _sdPath = ""; - _splashFile = ""; - _burnFirmware = false; - _renameFwFiles = false; - _patchImage = false; - _channelOrder = 0; - _defaultMode = 1; + _firmware = ""; + _name = ""; + _sdPath = ""; + _splashFile = ""; + _burnFirmware = false; + _renameFwFiles = false; + _patchImage = false; + _channelOrder = 0; + _defaultMode = 1; - _beeper = ""; - _countryCode = ""; - _display = ""; - _haptic = ""; - _speaker = ""; - _stickPotCalib = ""; - _trainerCalib = ""; + _beeper = ""; + _countryCode = ""; + _display = ""; + _haptic = ""; + _speaker = ""; + _stickPotCalib = ""; + _trainerCalib = ""; - _currentCalib = 0; - _gsStickMode = 0; - _ppmMultiplier = 0; - _vBatCalib = 0; - _vBatWarn = 0; + _currentCalib = 0; + _gsStickMode = 0; + _ppmMultiplier = 0; + _vBatCalib = 0; + _vBatWarn = 0; - // Do not write empty profiles to disk except the default (0) profile. - if ( index > 0 && !existsOnDisk()) - return; + // Do not write empty profiles to disk except the default (0) profile. + if ( index > 0 && !existsOnDisk()) + return; - flush(); + flush(); } void Profile::flush() { - // Load and store all variables. Use default values if setting values are missing - getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); + // Load and store all variables. Use default values if setting values are missing + getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); - getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); } @@ -563,105 +563,119 @@ void AppData::warningId (const int x) { store(x, _warningId, // Constructor AppData::AppData() { - //Initialize the profiles - for (int i=0; i Date: Sat, 22 Feb 2014 00:41:27 +0100 Subject: [PATCH 3/3] Souce buttons checked in edit splash dialog. Corrected faulty theme icon. --- companion/src/apppreferencesdialog.cpp | 4 -- companion/src/apppreferencesdialog.ui | 67 +++++++++++------- companion/src/customizesplashdialog.cpp | 22 ++++++ companion/src/customizesplashdialog.h | 4 ++ companion/src/customizesplashdialog.ui | 18 +++++ .../src/themes/monowhite/16/fwpreferences.png | Bin 435 -> 245 bytes 6 files changed, 86 insertions(+), 29 deletions(-) diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 1504051ee..5215fda5e 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -56,9 +56,6 @@ void appPreferencesDialog::writeValues() g.jsSupport(false); g.jsCtrl(0); } - - g.id(ui->profileIndexLE->text().toInt()); - g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex()); g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex()); g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked()); @@ -147,7 +144,6 @@ void appPreferencesDialog::initSettings() ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode()); ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles()); ui->sdPath->setText(g.profile[g.id()].sdPath()); - ui->profileIndexLE->setText(QString("%1").arg(g.id())); ui->profileNameLE->setText(g.profile[g.id()].name()); ui->firmwareLE->setText(g.profile[g.id()].firmware()); ui->SplashFileName->setText(g.profile[g.id()].splashFile()); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index 952881a7e..98824f3b5 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -7,7 +7,7 @@ 0 0 685 - 446 + 442 @@ -133,12 +133,12 @@ - Include companion splashes + Only show user splash images - Only user defined splashes + Show user and companion splash images @@ -706,13 +706,6 @@ This is used by the templated to determine which channel goes to what number out - - - - Qt::Horizontal - - - @@ -809,6 +802,12 @@ This is used by the templated to determine which channel goes to what number out 0 + + + 350 + 16777215 + + true @@ -862,10 +861,16 @@ This is used by the templated to determine which channel goes to what number out - 0 + 350 0 + + + 350 + 16777215 + + true @@ -883,6 +888,18 @@ This is used by the templated to determine which channel goes to what number out false + + + 350 + 0 + + + + + 350 + 16777215 + + @@ -899,27 +916,20 @@ This is used by the templated to determine which channel goes to what number out - - - - false - - - - 30 - 16777215 - - - - - 0 + 350 0 + + + 350 + 16777215 + + @@ -956,6 +966,13 @@ This is used by the templated to determine which channel goes to what number out + + + + Qt::Horizontal + + + diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp index 748c48b69..1be93d4a5 100644 --- a/companion/src/customizesplashdialog.cpp +++ b/companion/src/customizesplashdialog.cpp @@ -14,11 +14,21 @@ Side::Side(){ imageLabel = 0; fileNameEdit = 0; saveButton = 0; + loadFwButton=0; + loadPictButton = 0; + loadProfileButton = 0; saveToFileName = new QString(""); source = new Source(UNDEFINED); format = new LCDFormat(LCDTARANIS); } +void Side::markSourceButton() +{ + loadFwButton->setChecked(*source == FW ? true : false ); + loadPictButton->setChecked(*source == PICT ? true : false ); + loadProfileButton->setChecked(*source == PROFILE ? true : false ); +} + void Side::copyImage( Side side ) { if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED)) @@ -160,8 +170,17 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) : right.libraryButton = ui->rightLibraryButton; left.invertButton = ui->leftInvertButton; right.invertButton = ui->rightInvertButton; + + left.loadFwButton = ui->leftLoadFwButton; + right.loadFwButton = ui->rightLoadFwButton; + left.loadPictButton = ui->leftLoadPictButton; + right.loadPictButton = ui->rightLoadPictButton; + left.loadProfileButton = ui->leftLoadProfileButton; + right.loadProfileButton = ui->rightLoadProfileButton; loadProfile(left); + left.markSourceButton(); + resize(0,0); } @@ -189,6 +208,7 @@ void customizeSplashDialog::loadFirmware(Side side) else g.flashDir( QFileInfo(fileName).dir().absolutePath() ); } + side.markSourceButton(); } void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);} @@ -208,6 +228,7 @@ void customizeSplashDialog::loadPicture(Side side) else g.imagesDir( QFileInfo(fileName).dir().absolutePath() ); } + side.markSourceButton(); } void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);} @@ -220,6 +241,7 @@ void customizeSplashDialog::loadProfile(Side side) if (!side.displayImage( fileName, PROFILE )) QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName)); } + side.markSourceButton(); } void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);} diff --git a/companion/src/customizesplashdialog.h b/companion/src/customizesplashdialog.h index 21155dede..c931005b2 100644 --- a/companion/src/customizesplashdialog.h +++ b/companion/src/customizesplashdialog.h @@ -22,6 +22,7 @@ class Side { public: Side(); + void markSourceButton(); void copyImage( Side ); bool displayImage( QString fileName, Source source ); bool saveImage(); @@ -32,6 +33,9 @@ public: QPushButton *saveButton; QPushButton *invertButton; QToolButton *libraryButton; + QPushButton *loadFwButton; + QPushButton *loadPictButton; + QPushButton *loadProfileButton; QString *saveToFileName; diff --git a/companion/src/customizesplashdialog.ui b/companion/src/customizesplashdialog.ui index de4d68f24..72b241276 100644 --- a/companion/src/customizesplashdialog.ui +++ b/companion/src/customizesplashdialog.ui @@ -258,6 +258,9 @@ Load Profile + + true + @@ -265,6 +268,9 @@ Load FW + + true + @@ -272,6 +278,9 @@ Load Pict + + true + @@ -554,6 +563,9 @@ Load Profile + + true + @@ -564,6 +576,9 @@ Load FW + + true + @@ -571,6 +586,9 @@ Load Pict + + true + diff --git a/companion/src/themes/monowhite/16/fwpreferences.png b/companion/src/themes/monowhite/16/fwpreferences.png index b8e5ad449a5bf4027f3b556bfb972f6538ce096b..63fb581eb75f941f0cfa6c4cfd5362e34289d09f 100644 GIT binary patch delta 228 zcmdnY{FQNnWIY=L1B3kM|A|0~Ey>&6h2cL4F4((#GEjuGz$3Dlfr0NZ2s0kfUy%Y7 zWH0gbb!ETD#Ktek$5J*a6DZW=>Eak-aXL9+f#Q$z2M&A?^?Jz~TEjF(}!+qp|TJXUJz^Ha51zqD3>9SIwL}?WC-7=RfsOe&NFo%nUa& WH096TbT0=whr!d;&t;ucLK6V#K~R+d literal 435 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpafHr zx4R3&|Mvbf`++>p0*}aI1_r*vAk26?e?hYSQ<>y!K@%sbfn zT+n9OgSagkD`GPjG`p3ck-XJ5Gb<}=o?jR_m> z&H3RQm%ypK-0a5Pm;>eQe+8Huu7<}?+;>UUNG18|j_;N;a0n!C8<`)MX5lF!N|bSMAyJb*T5{q(9Fun#LB=x+rSV= jUe$TL9z{cLeoAIqC2kE%3ZsRA8W=oX{an^LB{Ts5y!4i?