Mainwindow size and position now gets saved/restored

actorid
Pieter van der Kloet 12 years ago
parent 1b9cf8c23f
commit 990895fd2b

@ -169,6 +169,7 @@ bool MainDialog::setup()
return false; return false;
} }
loadSettings();
return true; return true;
} }
@ -182,7 +183,14 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
void MainDialog::loadSettings() void MainDialog::loadSettings()
{ {
int width = mLauncherSettings.value(QString("General/MainWindow/width")).toInt();
int height = mLauncherSettings.value(QString("General/MainWindow/height")).toInt();
int posX = mLauncherSettings.value(QString("General/MainWindow/posx")).toInt();
int posY = mLauncherSettings.value(QString("General/MainWindow/posy")).toInt();
resize(width, height);
move(posX, posY);
} }
void MainDialog::saveSettings() void MainDialog::saveSettings()
@ -193,6 +201,12 @@ void MainDialog::saveSettings()
mLauncherSettings.setValue(QString("General/MainWindow/width"), width); mLauncherSettings.setValue(QString("General/MainWindow/width"), width);
mLauncherSettings.setValue(QString("General/MainWindow/height"), height); mLauncherSettings.setValue(QString("General/MainWindow/height"), height);
QString posX = QString::number(this->pos().x());
QString posY = QString::number(this->pos().y());
mLauncherSettings.setValue(QString("General/MainWindow/posx"), posX);
mLauncherSettings.setValue(QString("General/MainWindow/posy"), posY);
qDebug() << "size: " << width << height; qDebug() << "size: " << width << height;
} }

@ -69,6 +69,9 @@ void ProfilesComboBox::slotEditingFinished()
qDebug() << current << previous; qDebug() << current << previous;
if (currentIndex() == -1)
return;
if (current.isEmpty()) if (current.isEmpty())
return; return;
@ -78,13 +81,8 @@ void ProfilesComboBox::slotEditingFinished()
if (findText(current) != -1) if (findText(current) != -1)
return; return;
if (currentIndex() == -1) { setItemText(currentIndex(), current);
addItem(current); emit(profileRenamed(previous, current));
setCurrentIndex(findText(current));
} else {
setItemText(currentIndex(), current);
emit(profileRenamed(previous, current));
}
} }
void ProfilesComboBox::slotIndexChanged(int index) void ProfilesComboBox::slotIndexChanged(int index)

Loading…
Cancel
Save