1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 09:53:50 +00:00

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; 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;
} }

View file

@ -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) {
addItem(current);
setCurrentIndex(findText(current));
} else {
setItemText(currentIndex(), current); setItemText(currentIndex(), current);
emit(profileRenamed(previous, current)); emit(profileRenamed(previous, current));
}
} }
void ProfilesComboBox::slotIndexChanged(int index) void ProfilesComboBox::slotIndexChanged(int index)