mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 09:45:21 +03:00
Cosmetics
This commit is contained in:
parent
12a8770ad5
commit
f3521728ef
1 changed files with 634 additions and 650 deletions
|
@ -112,10 +112,8 @@ MainWindow::MainWindow():
|
||||||
QStringList strl = QApplication::arguments();
|
QStringList strl = QApplication::arguments();
|
||||||
QString str;
|
QString str;
|
||||||
QString printfilename;
|
QString printfilename;
|
||||||
int printing=false;
|
int printing = strl.contains("--print");
|
||||||
int model = -1;
|
int model = -1;
|
||||||
if (strl.contains("--print"))
|
|
||||||
printing=true;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach(QString arg, strl) {
|
foreach(QString arg, strl) {
|
||||||
count++;
|
count++;
|
||||||
|
@ -708,34 +706,27 @@ void MainWindow::copy()
|
||||||
|
|
||||||
void MainWindow::paste()
|
void MainWindow::paste()
|
||||||
{
|
{
|
||||||
if (activeMdiChild())
|
if (activeMdiChild()) activeMdiChild()->paste();
|
||||||
activeMdiChild()->paste();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::writeEeprom()
|
void MainWindow::writeEeprom()
|
||||||
{
|
{
|
||||||
if (activeMdiChild())
|
if (activeMdiChild()) activeMdiChild()->writeEeprom();
|
||||||
activeMdiChild()->writeEeprom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::simulate()
|
void MainWindow::simulate()
|
||||||
{
|
{
|
||||||
if (activeMdiChild()) {
|
if (activeMdiChild()) activeMdiChild()->radioSimulate();
|
||||||
activeMdiChild()->radioSimulate();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::print()
|
void MainWindow::print()
|
||||||
{
|
{
|
||||||
if (activeMdiChild())
|
if (activeMdiChild()) activeMdiChild()->print();
|
||||||
activeMdiChild()->print();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadBackup()
|
void MainWindow::loadBackup()
|
||||||
{
|
{
|
||||||
if (activeMdiChild())
|
if (activeMdiChild()) activeMdiChild()->loadBackup();
|
||||||
activeMdiChild()->loadBackup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::readEeprom()
|
void MainWindow::readEeprom()
|
||||||
|
@ -893,8 +884,9 @@ void MainWindow::updateMenus()
|
||||||
readEepromAct->setEnabled(true);
|
readEepromAct->setEnabled(true);
|
||||||
writeBackupToRadioAct->setEnabled(true);
|
writeBackupToRadioAct->setEnabled(true);
|
||||||
readBackupToFileAct->setEnabled(true);
|
readBackupToFileAct->setEnabled(true);
|
||||||
for (int i=0; i<MAX_RECENT; ++i)
|
for (int i=0; i<MAX_RECENT; ++i) {
|
||||||
recentFileActs[i]->setEnabled(true);
|
recentFileActs[i]->setEnabled(true);
|
||||||
|
}
|
||||||
separatorAct->setVisible(hasMdiChild);
|
separatorAct->setVisible(hasMdiChild);
|
||||||
simulateAct->setEnabled(hasSelection);
|
simulateAct->setEnabled(hasSelection);
|
||||||
printAct->setEnabled(hasSelection);
|
printAct->setEnabled(hasSelection);
|
||||||
|
@ -1065,8 +1057,9 @@ void MainWindow::createMenus()
|
||||||
fileMenu->addAction(saveAsAct);
|
fileMenu->addAction(saveAsAct);
|
||||||
fileMenu->addMenu(recentFileMenu);
|
fileMenu->addMenu(recentFileMenu);
|
||||||
recentFileMenu->setIcon(CompanionIcon("recentdocument.png"));
|
recentFileMenu->setIcon(CompanionIcon("recentdocument.png"));
|
||||||
for (int i=0; i<MAX_RECENT; ++i)
|
for (int i=0; i<MAX_RECENT; ++i) {
|
||||||
recentFileMenu->addAction(recentFileActs[i]);
|
recentFileMenu->addAction(recentFileActs[i]);
|
||||||
|
}
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
fileMenu->addAction(logsAct);
|
fileMenu->addAction(logsAct);
|
||||||
fileMenu->addAction(fwPrefsAct);
|
fileMenu->addAction(fwPrefsAct);
|
||||||
|
@ -1150,16 +1143,16 @@ void MainWindow::createMenus()
|
||||||
QMenu *MainWindow::createRecentFileMenu()
|
QMenu *MainWindow::createRecentFileMenu()
|
||||||
{
|
{
|
||||||
QMenu *recentFileMenu = new QMenu(this);
|
QMenu *recentFileMenu = new QMenu(this);
|
||||||
for ( int i = 0; i < MAX_RECENT; ++i)
|
for ( int i = 0; i < MAX_RECENT; ++i) {
|
||||||
recentFileMenu->addAction(recentFileActs[i]);
|
recentFileMenu->addAction(recentFileActs[i]);
|
||||||
|
}
|
||||||
return recentFileMenu;
|
return recentFileMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *MainWindow::createProfilesMenu()
|
QMenu *MainWindow::createProfilesMenu()
|
||||||
{
|
{
|
||||||
QMenu *profilesMenu=new QMenu(tr("Radio Profile"), this);
|
QMenu *profilesMenu=new QMenu(tr("Radio Profile"), this);
|
||||||
int i;
|
for (int i = 0; i < MAX_PROFILES; ++i) {
|
||||||
for ( i = 0; i < MAX_PROFILES; ++i) {
|
|
||||||
profilesMenu->addAction(profileActs[i]);
|
profilesMenu->addAction(profileActs[i]);
|
||||||
}
|
}
|
||||||
profilesMenu->addSeparator();
|
profilesMenu->addSeparator();
|
||||||
|
@ -1282,27 +1275,24 @@ QMdiSubWindow *MainWindow::findMdiChild(const QString &fileName)
|
||||||
|
|
||||||
void MainWindow::setActiveSubWindow(QWidget *window)
|
void MainWindow::setActiveSubWindow(QWidget *window)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window) return;
|
||||||
return;
|
|
||||||
mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(window));
|
mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateRecentFileActions()
|
void MainWindow::updateRecentFileActions()
|
||||||
{
|
{
|
||||||
int i, numRecentFiles;
|
|
||||||
|
|
||||||
// Hide all document slots
|
// Hide all document slots
|
||||||
for ( i=0 ; i < g.historySize(); i++)
|
for (int i=0 ; i<g.historySize(); i++) {
|
||||||
recentFileActs[i]->setVisible(false);
|
recentFileActs[i]->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Fill slots with content and unhide them
|
// Fill slots with content and unhide them
|
||||||
QStringList files = g.recentFiles();
|
QStringList files = g.recentFiles();
|
||||||
numRecentFiles = qMin(files.size(), g.historySize());
|
int numRecentFiles = qMin(files.size(), g.historySize());
|
||||||
|
|
||||||
for ( i = 0; i < numRecentFiles; i++) {
|
for (int i=0; i<numRecentFiles; i++) {
|
||||||
QString text = strippedName(files[i]);
|
QString text = strippedName(files[i]);
|
||||||
if (!text.trimmed().isEmpty())
|
if (!text.trimmed().isEmpty()) {
|
||||||
{
|
|
||||||
recentFileActs[i]->setText(text);
|
recentFileActs[i]->setText(text);
|
||||||
recentFileActs[i]->setData(files[i]);
|
recentFileActs[i]->setData(files[i]);
|
||||||
recentFileActs[i]->setVisible(true);
|
recentFileActs[i]->setVisible(true);
|
||||||
|
@ -1312,8 +1302,7 @@ void MainWindow::updateRecentFileActions()
|
||||||
|
|
||||||
void MainWindow::updateIconSizeActions()
|
void MainWindow::updateIconSizeActions()
|
||||||
{
|
{
|
||||||
switch (g.iconSize())
|
switch (g.iconSize()) {
|
||||||
{
|
|
||||||
case 0: smallIconAct->setChecked(true); break;
|
case 0: smallIconAct->setChecked(true); break;
|
||||||
case 1: normalIconAct->setChecked(true); break;
|
case 1: normalIconAct->setChecked(true); break;
|
||||||
case 2: bigIconAct->setChecked(true); break;
|
case 2: bigIconAct->setChecked(true); break;
|
||||||
|
@ -1359,8 +1348,7 @@ void MainWindow::updateLanguageActions()
|
||||||
|
|
||||||
void MainWindow::updateIconThemeActions()
|
void MainWindow::updateIconThemeActions()
|
||||||
{
|
{
|
||||||
switch (g.theme())
|
switch (g.theme()) {
|
||||||
{
|
|
||||||
case 0: classicThemeAct->setChecked(true); break;
|
case 0: classicThemeAct->setChecked(true); break;
|
||||||
case 1: yericoThemeAct->setChecked(true); break;
|
case 1: yericoThemeAct->setChecked(true); break;
|
||||||
case 2: monoWhiteAct->setChecked(true); break;
|
case 2: monoWhiteAct->setChecked(true); break;
|
||||||
|
@ -1371,10 +1359,8 @@ void MainWindow::updateIconThemeActions()
|
||||||
|
|
||||||
void MainWindow::updateProfilesActions()
|
void MainWindow::updateProfilesActions()
|
||||||
{
|
{
|
||||||
for (int i=0; i<MAX_PROFILES; i++)
|
for (int i=0; i<MAX_PROFILES; i++) {
|
||||||
{
|
if (g.profile[i].existsOnDisk()) {
|
||||||
if (g.profile[i].existsOnDisk())
|
|
||||||
{
|
|
||||||
QString text = tr("%2").arg(g.profile[i].name());
|
QString text = tr("%2").arg(g.profile[i].name());
|
||||||
profileActs[i]->setText(text);
|
profileActs[i]->setText(text);
|
||||||
profileActs[i]->setData(i);
|
profileActs[i]->setData(i);
|
||||||
|
@ -1382,8 +1368,7 @@ void MainWindow::updateProfilesActions()
|
||||||
if (i == g.id())
|
if (i == g.id())
|
||||||
profileActs[i]->setChecked(true);
|
profileActs[i]->setChecked(true);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
profileActs[i]->setVisible(false);
|
profileActs[i]->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1392,8 +1377,7 @@ void MainWindow::updateProfilesActions()
|
||||||
void MainWindow::createProfile()
|
void MainWindow::createProfile()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<MAX_PROFILES && g.profile[i].existsOnDisk(); i++)
|
for (i=0; i<MAX_PROFILES && g.profile[i].existsOnDisk(); i++);
|
||||||
;
|
|
||||||
if (i==MAX_PROFILES) //Failed to find free slot
|
if (i==MAX_PROFILES) //Failed to find free slot
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue