mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 17:25:13 +03:00
Another code reduction. Settings are now stored in "OpenTX/Companion",
instead of "companion/companion"
This commit is contained in:
parent
0d394ca7c6
commit
439cabe83c
35 changed files with 465 additions and 650 deletions
|
@ -62,28 +62,26 @@
|
|||
#include "helpers.h"
|
||||
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
|
||||
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define C9X_STAMP "http://companion9x.googlecode.com/svn/trunk/companion9x-macosx.stamp"
|
||||
#define C9X_INSTALLER "/Companion9xMacUpdate.%1.pkg.zip"
|
||||
#define C9X_URL "http://companion9x.googlecode.com/files/Companion9xMacUpdate.%1.pkg.zip"
|
||||
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-macosx.stamp"
|
||||
#define C9X_INSTALLER "/CompanionMacUpdate.%1.pkg.zip"
|
||||
#else
|
||||
#define C9X_STAMP "http://companion9x.googlecode.com/svn/trunk/companion9x.stamp"
|
||||
#define C9X_INSTALLER "/companion9xInstall_v%1.exe"
|
||||
#define C9X_URL "http://companion9x.googlecode.com/files/companion9xInstall_v%1.exe"
|
||||
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-windows.stamp"
|
||||
#define C9X_INSTALLER "/companionInstall_%1.exe"
|
||||
#endif
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(x*1000)
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(x*1000)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include "mountlist.h"
|
||||
#include <unistd.h>
|
||||
#include "mountlist.h"
|
||||
#endif
|
||||
|
||||
|
||||
MainWindow::MainWindow():
|
||||
downloadDialog_forWait(NULL)
|
||||
downloadDialog_forWait(NULL)
|
||||
{
|
||||
mdiArea = new QMdiArea;
|
||||
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
@ -96,7 +94,7 @@ downloadDialog_forWait(NULL)
|
|||
this, SLOT(setActiveSubWindow(QWidget*)));
|
||||
|
||||
MaxRecentFiles=MAX_RECENT;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int icon_size=settings.value("icon_size", 1).toInt();
|
||||
switch (icon_size) {
|
||||
case 0:
|
||||
|
@ -138,8 +136,9 @@ downloadDialog_forWait(NULL)
|
|||
// give time to the splash to disappear and main window to open before starting updates
|
||||
int updateDelay = 1000;
|
||||
bool showSplash = settings.value("show_splash", true).toBool();
|
||||
if (showSplash)
|
||||
updateDelay += (SPLASH_TIME*1000);
|
||||
if (showSplash) {
|
||||
updateDelay += (SPLASH_TIME*1000);
|
||||
}
|
||||
QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates()));
|
||||
QTimer::singleShot(updateDelay, this, SLOT(displayWarnings()));
|
||||
|
||||
|
@ -189,7 +188,7 @@ downloadDialog_forWait(NULL)
|
|||
|
||||
void MainWindow::displayWarnings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int warnId=settings.value("warningId", 0 ).toInt();
|
||||
if (warnId<WARNING_ID && warnId!=0) {
|
||||
int res=0;
|
||||
|
@ -223,7 +222,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
|
|||
showcheckForUpdatesResult = ignoreSettings;
|
||||
check1done = true;
|
||||
check2done = true;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
fwToUpdate = fwId;
|
||||
QString stamp = GetFirmware(fwToUpdate)->stamp;
|
||||
|
||||
|
@ -289,7 +288,7 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
|
|||
"Would you like to download it?").arg(version) ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
|
||||
if (ret == QMessageBox::Yes) {
|
||||
#if defined __APPLE__
|
||||
|
@ -299,14 +298,14 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
|
|||
#endif
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastUpdatesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
downloadDialog * dd = new downloadDialog(this, QString(C9X_URL).arg(version), fileName);
|
||||
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName);
|
||||
installer_fileName = fileName;
|
||||
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
|
||||
dd->show();
|
||||
}
|
||||
}
|
||||
#else
|
||||
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available please check the repository"));
|
||||
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available please check the OpenTX website!"));
|
||||
#endif
|
||||
} else {
|
||||
if (showcheckForUpdatesResult && check1done && check2done)
|
||||
|
@ -331,7 +330,7 @@ void MainWindow::updateDownloaded()
|
|||
void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmwareId)
|
||||
{
|
||||
QString url, ext, cpuid;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
url = firmware->getUrl(firmwareId);
|
||||
cpuid=settings.value("cpuid","").toString();
|
||||
ext = url.mid(url.lastIndexOf("."));
|
||||
|
@ -354,7 +353,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw
|
|||
void MainWindow::reply1Accepted()
|
||||
{
|
||||
QString errormsg;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool autoflash=settings.value("burnFirmware", true).toBool();
|
||||
bool addversion=settings.value("rename_firmware_files", false).toBool();
|
||||
settings.beginGroup("FwRevisions");
|
||||
|
@ -478,7 +477,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
// TODO delete downloadDialog_forWait?
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
cpuid=settings.value("cpuid","").toString();
|
||||
QByteArray qba = reply->readAll();
|
||||
int i = qba.indexOf("SVN_VERS");
|
||||
|
@ -630,13 +629,14 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("mainWindowGeometry", saveGeometry());
|
||||
settings.setValue("mainWindowState", saveState());
|
||||
mdiArea->closeAllSubWindows();
|
||||
if (mdiArea->currentSubWindow()) {
|
||||
event->ignore();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ void MainWindow::newFile()
|
|||
|
||||
void MainWindow::openFile()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastDir").toString(),tr(EEPROM_FILES_FILTER));
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
|
||||
|
@ -683,7 +683,7 @@ void MainWindow::saveAs()
|
|||
|
||||
void MainWindow::openRecentFile()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action) {
|
||||
QString fileName=action->data().toString();
|
||||
|
@ -705,14 +705,14 @@ void MainWindow::openRecentFile()
|
|||
|
||||
void MainWindow::loadProfile()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
int chord,defmod, burnfw;
|
||||
bool renfw;
|
||||
|
||||
if (action) {
|
||||
int profnum=action->data().toInt();
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("ActiveProfile",profnum);
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profnum);
|
||||
|
@ -757,8 +757,8 @@ void MainWindow::unloadProfile()
|
|||
{
|
||||
ActiveProfile=0;
|
||||
ActiveProfileName="";
|
||||
QSettings settings("companion", "companion");
|
||||
settings.setValue("ActiveProfile",0);
|
||||
QSettings settings;
|
||||
settings.setValue("ActiveProfile", 0);
|
||||
FirmwareInfo *firmware = GetCurrentFirmware();
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
|
||||
}
|
||||
|
@ -770,7 +770,8 @@ void MainWindow::preferences()
|
|||
FirmwareInfo *firmware = GetCurrentFirmware();
|
||||
if (ActiveProfile) {
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
|
||||
}
|
||||
|
||||
|
@ -1080,21 +1081,17 @@ 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);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("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);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
res = ad->exec();
|
||||
}
|
||||
if(QFileInfo(tempFile).exists() && res) {
|
||||
if (QFileInfo(tempFile).exists() && res) {
|
||||
MdiChild *child = createMdiChild();
|
||||
child->newFile();
|
||||
child->loadFile(tempFile, false);
|
||||
|
@ -1104,7 +1101,7 @@ void MainWindow::burnFrom()
|
|||
|
||||
void MainWindow::burnExtenalToEEPROM()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName;
|
||||
bool backup = false;
|
||||
burnDialog *cd = new burnDialog(this, 1, &fileName, &backup);
|
||||
|
@ -1141,18 +1138,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);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("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"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
sleep(1);
|
||||
}
|
||||
|
@ -1162,9 +1155,7 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
QString tempFlash = tempDir + "/flash.bin";
|
||||
QStringList str = GetReceiveFlashCommand(tempFlash);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx");
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_flash.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_flash.png"));
|
||||
ad->exec();
|
||||
sleep(1);
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
|
@ -1177,7 +1168,8 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
int rev = getEpromVersion(restoreFile);
|
||||
if ((rev / 100) != (oldrev / 100)) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The transmitter firmware belongs to another product family, check file and preferences!"));
|
||||
} else if (rev < oldrev) {
|
||||
}
|
||||
else if (rev < oldrev) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The transmitter firmware is outdated, please upgrade!"));
|
||||
}
|
||||
fileName = restoreFile;
|
||||
|
@ -1197,19 +1189,18 @@ 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);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
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"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
@ -1219,23 +1210,23 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str;
|
||||
str << fileName << path;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write Models and Settings To Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str = GetSendEEpromCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Models and Settings To Tx", AVR_DIALOG_SHOW_DONE);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"write_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1327,7 +1318,8 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
} else {
|
||||
version = fwBuild.toInt(); // TODO changer le nom de la variable
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
version = ((Open9xFirmware *)firmware)->getEepromVersion(revision);
|
||||
}
|
||||
}
|
||||
|
@ -1344,11 +1336,8 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
long result = file.read((char*)eeprom, eeprom_size);
|
||||
file.close();
|
||||
|
||||
RadioData radioData;
|
||||
if (!LoadEeprom(radioData, eeprom, eeprom_size))
|
||||
return false;
|
||||
|
||||
if (!firmware->saveEEPROM(eeprom, radioData, variant, version))
|
||||
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
|
||||
if (!LoadEeprom(*radioData, eeprom, eeprom_size) || !firmware->saveEEPROM(eeprom, *radioData, variant, version))
|
||||
return false;
|
||||
|
||||
QFile file2(restoreFile);
|
||||
|
@ -1366,7 +1355,7 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
|
||||
void MainWindow::burnToFlash(QString fileToFlash)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName;
|
||||
bool backup = settings.value("backupOnFlash", false).toBool();
|
||||
if(!fileToFlash.isEmpty())
|
||||
|
@ -1399,18 +1388,17 @@ 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);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
int res = ad->exec();
|
||||
delete ad;
|
||||
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);
|
||||
QIcon iconw;
|
||||
populate_icon(&iconw,"write_eeprom.png");
|
||||
CompanionIcon iconw("write_eeprom.png");
|
||||
ad->setWindowIcon(iconw);
|
||||
int res = ad->exec();
|
||||
delete ad;
|
||||
if (res) {
|
||||
QString restoreFile = tempDir + "/restore.bin";
|
||||
if (!convertEEPROM(backupFile, restoreFile, fileName)) {
|
||||
|
@ -1421,17 +1409,21 @@ void MainWindow::burnToFlash(QString fileToFlash)
|
|||
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(iconw);
|
||||
res=ad->exec();
|
||||
res = ad->exec();
|
||||
delete ad;
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Firmware write failed"), tr("Could not write firmware to to transmitter. The models and settings data file can be found at: %1").arg(backupFile));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Backup failed"), tr("Cannot backup existing Models and Settings from TX. Firmware write process aborted"));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bool backupEnable=settings.value("backupEnable", true).toBool();
|
||||
QString backupPath=settings.value("backupPath", "").toString();
|
||||
if (!QDir(backupPath).exists()) {
|
||||
|
@ -1445,26 +1437,24 @@ 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"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
QStringList str = GetSendFlashCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_SHOW_DONE);
|
||||
QIcon iconw;
|
||||
populate_icon(&iconw,"write_flash.png");
|
||||
ad->setWindowIcon(iconw);
|
||||
ad->setWindowIcon(CompanionIcon("write_flash.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::burnExtenalFromEEPROM()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save transmitter Models and Settings to File"), settings.value("lastDir").toString(), tr(EXTERNAL_EEPROM_FILES_FILTER));
|
||||
if (!fileName.isEmpty()) {
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
|
@ -1473,30 +1463,30 @@ void MainWindow::burnExtenalFromEEPROM()
|
|||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify that the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str;
|
||||
str << path << fileName;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
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"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::burnFromFlash()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Read Tx Firmware to File"), settings.value("lastFlashDir").toString(),tr(FLASH_FILES_FILTER));
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
|
@ -1506,12 +1496,10 @@ 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");
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_flash.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_flash.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::burnConfig()
|
||||
|
@ -1547,7 +1535,7 @@ void MainWindow::logFile()
|
|||
void MainWindow::about()
|
||||
{
|
||||
QString aboutStr = "<center><img src=\":/images/companion-title.png\"></center><br>";
|
||||
aboutStr.append("OpenTX Home Page: <a href='http://opentx.github.io'>http://open-tx.org</a><br><br>");
|
||||
aboutStr.append("OpenTX Home Page: <a href='http://opentx.github.io'>http://www.open-tx.org</a><br><br>");
|
||||
aboutStr.append(tr("The Companion project was originally forked from eePe")+QString(" <a href='http://code.google.com/p/eepe'>http://code.google.com/p/eepe</a><br/><br/>"));
|
||||
aboutStr.append(tr("If you've found this program useful, please support by"));
|
||||
aboutStr.append(" <a href='" DONATE_STR "'>");
|
||||
|
@ -1584,7 +1572,7 @@ void MainWindow::updateMenus()
|
|||
updateRecentFileActions();
|
||||
updateProfilesActions();
|
||||
bool notfound=true;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
for (int i=0; i<MAX_PROFILES; i++) {
|
||||
QString profile=QString("profile%1").arg(i+1);
|
||||
|
@ -1648,191 +1636,134 @@ MdiChild *MainWindow::createMdiChild()
|
|||
|
||||
void MainWindow::createActions()
|
||||
{
|
||||
QIcon newActIcon;
|
||||
populate_icon(&newActIcon,"new.png");
|
||||
|
||||
newAct = new QAction(newActIcon, tr("&New"), this);
|
||||
newAct = new QAction(CompanionIcon("new.png"), tr("&New"), this);
|
||||
newAct->setShortcuts(QKeySequence::New);
|
||||
newAct->setStatusTip(tr("Create a new file"));
|
||||
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||
|
||||
QIcon openActIcon;
|
||||
populate_icon(&openActIcon,"open.png");
|
||||
openAct = new QAction(openActIcon, tr("&Open..."), this);
|
||||
openAct = new QAction(CompanionIcon("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(openActIcon, tr("&loadBackup..."), this);
|
||||
loadbackupAct = new QAction(CompanionIcon("open.png"), tr("&loadBackup..."), this);
|
||||
loadbackupAct->setStatusTip(tr("Load backup from file"));
|
||||
connect(loadbackupAct, SIGNAL(triggered()), this, SLOT(loadBackup()));
|
||||
|
||||
QIcon saveActIcon;
|
||||
populate_icon(&saveActIcon,"save.png");
|
||||
saveAct = new QAction(saveActIcon, tr("&Save"), this);
|
||||
saveAct = new QAction(CompanionIcon("save.png"), tr("&Save"), this);
|
||||
saveAct->setShortcuts(QKeySequence::Save);
|
||||
saveAct->setStatusTip(tr("Save the document to disk"));
|
||||
connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
|
||||
|
||||
QIcon saveAsActIcon;
|
||||
populate_icon(&saveAsActIcon,"saveas.png");
|
||||
saveAsAct = new QAction(saveAsActIcon, tr("Save &As..."), this);
|
||||
saveAsAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon logsActIcon;
|
||||
populate_icon(&logsActIcon,"logs.png");
|
||||
logsAct = new QAction(logsActIcon, tr("Lo&gs"), this);
|
||||
logsAct = new QAction(CompanionIcon("logs.png"), tr("Lo&gs"), this);
|
||||
logsAct->setShortcut(tr("Ctrl+G"));
|
||||
logsAct->setStatusTip(tr("Open log file"));
|
||||
connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile()));
|
||||
|
||||
QIcon preferencesActIcon;
|
||||
populate_icon(&preferencesActIcon,"preferences.png");
|
||||
preferencesAct = new QAction(preferencesActIcon, tr("&Preferences..."), this);
|
||||
preferencesAct = new QAction(CompanionIcon("preferences.png"), tr("&Preferences..."), this);
|
||||
preferencesAct->setStatusTip(tr("Edit general preferences"));
|
||||
connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences()));
|
||||
|
||||
QIcon checkForUpdatesActIcon;
|
||||
populate_icon(&checkForUpdatesActIcon,"update.png");
|
||||
checkForUpdatesAct = new QAction(checkForUpdatesActIcon, tr("&Check for updates..."), this);
|
||||
checkForUpdatesAct = new QAction(CompanionIcon("update.png"), tr("&Check for updates..."), this);
|
||||
checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion"));
|
||||
connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates()));
|
||||
|
||||
QIcon contributorsActIcon;
|
||||
populate_icon(&contributorsActIcon,"contributors.png");
|
||||
contributorsAct = new QAction(contributorsActIcon, tr("Contributors &List..."), this);
|
||||
contributorsAct = new QAction(CompanionIcon("contributors.png"), tr("Contributors &List..."), this);
|
||||
contributorsAct->setStatusTip(tr("Show Companion contributors list"));
|
||||
connect(contributorsAct, SIGNAL(triggered()), this, SLOT(contributors()));
|
||||
|
||||
QIcon changelogActIcon;
|
||||
populate_icon(&changelogActIcon,"changelog.png");
|
||||
changelogAct = new QAction(changelogActIcon, tr("ChangeLog..."), this);
|
||||
changelogAct = new QAction(CompanionIcon("changelog.png"), tr("ChangeLog..."), this);
|
||||
changelogAct->setStatusTip(tr("Show Companion changelog"));
|
||||
connect(changelogAct, SIGNAL(triggered()), this, SLOT(changelog()));
|
||||
|
||||
QIcon fwchangelogActIcon;
|
||||
populate_icon(&fwchangelogActIcon,"changelog.png");
|
||||
fwchangelogAct = new QAction(fwchangelogActIcon, tr("Firmware ChangeLog..."), this);
|
||||
fwchangelogAct = new QAction(CompanionIcon("changelog.png"), tr("Firmware ChangeLog..."), this);
|
||||
fwchangelogAct->setStatusTip(tr("Show firmware changelog"));
|
||||
connect(fwchangelogAct, SIGNAL(triggered()), this, SLOT(fwchangelog()));
|
||||
|
||||
QIcon compareActIcon;
|
||||
populate_icon(&compareActIcon,"compare.png");
|
||||
compareAct = new QAction(compareActIcon, tr("Compare..."), this);
|
||||
compareAct = new QAction(CompanionIcon("customize.png"), tr("Compare..."), this);
|
||||
compareAct->setStatusTip(tr("Compare models"));
|
||||
compareAct->setEnabled(false);
|
||||
connect(compareAct, SIGNAL(triggered()), this, SLOT(compare()));
|
||||
|
||||
QIcon customizeSplashActIcon;
|
||||
populate_icon(&customizeSplashActIcon,"customize.png");
|
||||
customizeSplashAct = new QAction(customizeSplashActIcon, tr("Customize your &TX..."), this);
|
||||
customizeSplashAct = new QAction(CompanionIcon("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]
|
||||
QIcon exitActIcon;
|
||||
populate_icon(&exitActIcon,"exit.png");
|
||||
exitAct = new QAction(exitActIcon, tr("E&xit"), this);
|
||||
exitAct = new QAction(CompanionIcon("exit.png"), tr("E&xit"), this);
|
||||
exitAct->setShortcuts(QKeySequence::Quit);
|
||||
exitAct->setStatusTip(tr("Exit the application"));
|
||||
connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
|
||||
//! [0]
|
||||
|
||||
QIcon cutActIcon;
|
||||
populate_icon(&cutActIcon,"cut.png");
|
||||
cutAct = new QAction(cutActIcon, tr("Cu&t"), this);
|
||||
cutAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon copyActIcon;
|
||||
populate_icon(©ActIcon,"copy.png");
|
||||
copyAct = new QAction(copyActIcon, tr("&Copy"), this);
|
||||
copyAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon pasteActIcon;
|
||||
populate_icon(&pasteActIcon,"paste.png");
|
||||
pasteAct = new QAction(pasteActIcon, tr("&Paste"), this);
|
||||
pasteAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon burnToActIcon;
|
||||
populate_icon(&burnToActIcon,"write_eeprom.png");
|
||||
burnToAct = new QAction(burnToActIcon, tr("&Write Models and Settings To Tx"), this);
|
||||
burnToAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon burnFromActIcon;
|
||||
populate_icon(&burnFromActIcon,"read_eeprom.png");
|
||||
burnFromAct = new QAction(burnFromActIcon, tr("&Read Models and Settings From Tx"), this);
|
||||
burnFromAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon burnToFlashActIcon;
|
||||
populate_icon(&burnToFlashActIcon,"write_flash.png");
|
||||
burnToFlashAct = new QAction(burnToFlashActIcon, tr("Write Firmware"), this);
|
||||
burnToFlashAct = new QAction(CompanionIcon("write_flash.png"), tr("Write Firmware"), this);
|
||||
burnToFlashAct->setStatusTip(tr("Write firmware to transmitter"));
|
||||
connect(burnToFlashAct,SIGNAL(triggered()),this,SLOT(burnToFlash()));
|
||||
|
||||
QIcon burnExtenalToEEPROMActIcon;
|
||||
populate_icon(&burnExtenalToEEPROMActIcon,"write_eeprom_file.png");
|
||||
burnExtenalToEEPROMAct = new QAction(burnExtenalToEEPROMActIcon, tr("Write Models and Settings from file to Tx"), this);
|
||||
burnExtenalToEEPROMAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon burnExtenalFromEEPROMActIcon;
|
||||
populate_icon(&burnExtenalFromEEPROMActIcon,"read_eeprom_file.png");
|
||||
burnExtenalFromEEPROMAct = new QAction(burnExtenalFromEEPROMActIcon, tr("Save transmitter Models and Settings to file"), this);
|
||||
burnExtenalFromEEPROMAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon burnFromFlashActIcon;
|
||||
populate_icon(&burnFromFlashActIcon,"read_flash.png");
|
||||
burnFromFlashAct = new QAction(burnFromFlashActIcon, tr("Read Firmware"), this);
|
||||
burnFromFlashAct = new QAction(CompanionIcon("read_flash.png"), tr("Read Firmware"), this);
|
||||
burnFromFlashAct->setStatusTip(tr("Read firmware from transmitter"));
|
||||
connect(burnFromFlashAct,SIGNAL(triggered()),this,SLOT(burnFromFlash()));
|
||||
|
||||
QIcon burnConfigActIcon;
|
||||
populate_icon(&burnConfigActIcon,"configure.png");
|
||||
burnConfigAct = new QAction(burnConfigActIcon, tr("&Configure..."), this);
|
||||
burnConfigAct = new QAction(CompanionIcon("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())) {
|
||||
QIcon burnListActIcon;
|
||||
populate_icon(&burnListActIcon,"list.png");
|
||||
burnListAct = new QAction(burnListActIcon, tr("&List programmers"), this);
|
||||
burnListAct = new QAction(CompanionIcon("list.png"), tr("&List programmers"), this);
|
||||
burnListAct->setStatusTip(tr("List available programmers"));
|
||||
connect(burnListAct,SIGNAL(triggered()),this,SLOT(burnList()));
|
||||
|
||||
QIcon burnFusesActIcon;
|
||||
populate_icon(&burnFusesActIcon,"fuses.png");
|
||||
burnFusesAct = new QAction(burnFusesActIcon, tr("&Fuses..."), this);
|
||||
burnFusesAct = new QAction(CompanionIcon("fuses.png"), tr("&Fuses..."), this);
|
||||
burnFusesAct->setStatusTip(tr("Show fuses dialog"));
|
||||
connect(burnFusesAct,SIGNAL(triggered()),this,SLOT(burnFuses()));
|
||||
}
|
||||
QIcon simulateActIcon;
|
||||
populate_icon(&simulateActIcon,"simulate.png");
|
||||
simulateAct = new QAction(simulateActIcon, tr("&Simulate"), this);
|
||||
|
||||
simulateAct = new QAction(CompanionIcon("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()));
|
||||
|
||||
QIcon printActIcon;
|
||||
populate_icon(&printActIcon,"print.png");
|
||||
printAct = new QAction(printActIcon, tr("&Print"), this);
|
||||
printAct = new QAction(CompanionIcon("print.png"), tr("&Print"), this);
|
||||
printAct->setShortcut(tr("Ctrl+P"));
|
||||
printAct->setStatusTip(tr("Print current model."));
|
||||
printAct->setEnabled(false);
|
||||
|
@ -1872,15 +1803,11 @@ void MainWindow::createActions()
|
|||
separatorAct = new QAction(this);
|
||||
separatorAct->setSeparator(true);
|
||||
|
||||
QIcon aboutActIcon;
|
||||
populate_icon(&aboutActIcon,"information.png");
|
||||
aboutAct = new QAction(aboutActIcon, tr("&About"), this);
|
||||
aboutAct = new QAction(CompanionIcon("information.png"), tr("&About"), this);
|
||||
aboutAct->setStatusTip(tr("Show the application's About box"));
|
||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
||||
|
||||
QIcon switchLayoutDirectionActIcon;
|
||||
populate_icon(&switchLayoutDirectionActIcon,"switch_dir.png");
|
||||
switchLayoutDirectionAct = new QAction(switchLayoutDirectionActIcon, tr("Switch layout direction"), this);
|
||||
switchLayoutDirectionAct = new QAction(CompanionIcon("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) {
|
||||
|
@ -1910,10 +1837,8 @@ void MainWindow::createMenus()
|
|||
fileMenu->addAction(saveAct);
|
||||
fileMenu->addAction(saveAsAct);
|
||||
fileMenu->addMenu(recentFileMenu);
|
||||
QIcon recentFileMenuIcon;
|
||||
populate_icon(&recentFileMenuIcon,"recentdocument.png");
|
||||
recentFileMenu->setIcon(recentFileMenuIcon);
|
||||
for ( int i = 0; i < MaxRecentFiles; ++i)
|
||||
recentFileMenu->setIcon(CompanionIcon("recentdocument.png"));
|
||||
for (int i=0; i<MaxRecentFiles; ++i)
|
||||
recentFileMenu->addAction(recentFileActs[i]);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(logsAct);
|
||||
|
@ -1925,10 +1850,8 @@ void MainWindow::createMenus()
|
|||
fileMenu->addAction(preferencesAct);
|
||||
fileMenu->addMenu(profilesMenu);
|
||||
|
||||
QIcon profilesMenuIcon;
|
||||
populate_icon(&profilesMenuIcon,"profiles.png");
|
||||
profilesMenu->setIcon(profilesMenuIcon);
|
||||
for ( int i = 0; i < MAX_PROFILES; ++i)
|
||||
profilesMenu->setIcon(CompanionIcon("profiles.png"));
|
||||
for (int i=0; i<MAX_PROFILES; ++i)
|
||||
profilesMenu->addAction(profileActs[i]);
|
||||
fileMenu->addAction(switchLayoutDirectionAct);
|
||||
fileMenu->addAction(exitAct);
|
||||
|
@ -1992,7 +1915,7 @@ QMenu *MainWindow::createProfilesMenu()
|
|||
|
||||
void MainWindow::createToolBars()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int icon_size=settings.value("icon_size",2 ).toInt();
|
||||
QSize size;
|
||||
switch(icon_size) {
|
||||
|
@ -2017,9 +1940,7 @@ void MainWindow::createToolBars()
|
|||
QToolButton * recentToolButton = new QToolButton;
|
||||
recentToolButton->setPopupMode(QToolButton::InstantPopup);
|
||||
recentToolButton->setMenu(createRecentFileMenu());
|
||||
QIcon recentToolButtonIcon;
|
||||
populate_icon(&recentToolButtonIcon,"recentdocument.png");
|
||||
recentToolButton->setIcon(recentToolButtonIcon);
|
||||
recentToolButton->setIcon(CompanionIcon("recentdocument.png"));
|
||||
recentToolButton->setToolTip(tr("Recent Files"));
|
||||
fileToolBar->addWidget(recentToolButton);
|
||||
fileToolBar->addAction(saveAct);
|
||||
|
@ -2029,9 +1950,7 @@ void MainWindow::createToolBars()
|
|||
profileButton = new QToolButton;
|
||||
profileButton->setPopupMode(QToolButton::InstantPopup);
|
||||
profileButton->setMenu(createProfilesMenu());
|
||||
QIcon profileButtonIcon;
|
||||
populate_icon(&profileButtonIcon,"profiles.png");
|
||||
profileButton->setIcon(profileButtonIcon);
|
||||
profileButton->setIcon(CompanionIcon("profiles.png"));
|
||||
profileButton->setToolTip(tr("Firmware Profiles"));
|
||||
fileToolBar->addWidget(profileButton);
|
||||
bool notfound=true;
|
||||
|
@ -2088,7 +2007,7 @@ void MainWindow::createStatusBar()
|
|||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
restoreState(settings.value("mainWindowState").toByteArray());
|
||||
checkCompanion9x = settings.value("startup_check_companion", true).toBool();
|
||||
checkFW = settings.value("startup_check_fw", true).toBool();
|
||||
|
@ -2141,7 +2060,7 @@ void MainWindow::setActiveSubWindow(QWidget *window)
|
|||
void MainWindow::updateRecentFileActions()
|
||||
{
|
||||
int i,j, numRecentFiles;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
|
||||
numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
|
||||
|
@ -2161,7 +2080,7 @@ void MainWindow::updateRecentFileActions()
|
|||
void MainWindow::updateProfilesActions()
|
||||
{
|
||||
int i;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
for (i=0; i<MAX_PROFILES; i++) {
|
||||
QString profile=QString("profile%1").arg(i+1);
|
||||
|
@ -2278,7 +2197,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
|||
QString fileName = urls.first().toLocalFile();
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
|
||||
|
||||
QMdiSubWindow *existing = findMdiChild(fileName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue