Mainwindow size and position now gets saved/restored

This commit is contained in:
Pieter van der Kloet 2013-02-15 14:12:25 +01:00
parent 1b9cf8c23f
commit 990895fd2b
2 changed files with 19 additions and 7 deletions

View file

@ -169,6 +169,7 @@ bool MainDialog::setup()
return false;
}
loadSettings();
return true;
}
@ -182,7 +183,14 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
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()
@ -193,6 +201,12 @@ void MainDialog::saveSettings()
mLauncherSettings.setValue(QString("General/MainWindow/width"), width);
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;
}

View file

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