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