Manager: Remember the machine list size in addition to window size and position
This commit is contained in:
@@ -740,6 +740,18 @@ VMManagerMain::machineCountString(QString states) const
|
|||||||
return tr("VMs: %1").arg(states);
|
return tr("VMs: %1").arg(states);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<int>
|
||||||
|
VMManagerMain::getPaneSizes() const
|
||||||
|
{
|
||||||
|
return ui->splitter->sizes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VMManagerMain::setPaneSizes(const QList<int> &sizes)
|
||||||
|
{
|
||||||
|
ui->splitter->setSizes(sizes);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VMManagerMain::modelDataChange()
|
VMManagerMain::modelDataChange()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ public slots:
|
|||||||
void onConfigUpdated(const QString &uuid);
|
void onConfigUpdated(const QString &uuid);
|
||||||
int getActiveMachineCount();
|
int getActiveMachineCount();
|
||||||
|
|
||||||
|
QList<int> getPaneSizes() const;
|
||||||
|
void setPaneSizes(const QList<int> &sizes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::VMManagerMain *ui;
|
Ui::VMManagerMain *ui;
|
||||||
|
|
||||||
|
|||||||
@@ -151,10 +151,20 @@ VMManagerMainWindow(QWidget *parent)
|
|||||||
if (!!config->getStringValue("window_maximized").toInt()) {
|
if (!!config->getStringValue("window_maximized").toInt()) {
|
||||||
setWindowState(windowState() | Qt::WindowMaximized);
|
setWindowState(windowState() | Qt::WindowMaximized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list = config->getStringValue("window_splitter").split(',');
|
||||||
|
for (auto& cur : list) {
|
||||||
|
cur = cur.trimmed();
|
||||||
|
}
|
||||||
|
QList<int> paneSizes;
|
||||||
|
paneSizes.append(list[0].toInt());
|
||||||
|
paneSizes.append(list[1].toInt());
|
||||||
|
vmm->setPaneSizes(paneSizes);
|
||||||
} else {
|
} else {
|
||||||
config->setStringValue("window_remember", "");
|
config->setStringValue("window_remember", "");
|
||||||
config->setStringValue("window_coordinates", "");
|
config->setStringValue("window_coordinates", "");
|
||||||
config->setStringValue("window_maximized", "");
|
config->setStringValue("window_maximized", "");
|
||||||
|
config->setStringValue("window_splitter", "");
|
||||||
}
|
}
|
||||||
delete config;
|
delete config;
|
||||||
}
|
}
|
||||||
@@ -218,10 +228,12 @@ VMManagerMainWindow::saveSettings() const
|
|||||||
if (ui->actionRemember_size_and_position->isChecked()) {
|
if (ui->actionRemember_size_and_position->isChecked()) {
|
||||||
config->setStringValue("window_coordinates", QString::asprintf("%i, %i, %i, %i", this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
|
config->setStringValue("window_coordinates", QString::asprintf("%i, %i, %i, %i", this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
|
||||||
config->setStringValue("window_maximized", this->isMaximized() ? "1" : "");
|
config->setStringValue("window_maximized", this->isMaximized() ? "1" : "");
|
||||||
|
config->setStringValue("window_splitter", QString::asprintf("%i, %i", vmm->getPaneSizes()[0], vmm->getPaneSizes()[1]));
|
||||||
} else {
|
} else {
|
||||||
config->setStringValue("window_remember", "");
|
config->setStringValue("window_remember", "");
|
||||||
config->setStringValue("window_coordinates", "");
|
config->setStringValue("window_coordinates", "");
|
||||||
config->setStringValue("window_maximized", "");
|
config->setStringValue("window_maximized", "");
|
||||||
|
config->setStringValue("window_splitter", "");
|
||||||
}
|
}
|
||||||
// Sometimes required to ensure the settings save before the app exits
|
// Sometimes required to ensure the settings save before the app exits
|
||||||
config->sync();
|
config->sync();
|
||||||
|
|||||||
Reference in New Issue
Block a user