feat: remember splitter state

This commit is contained in:
arm64v8a
2023-03-25 14:52:41 +09:00
parent 180a764977
commit cb2fabd11c
6 changed files with 12 additions and 6 deletions

View File

@@ -112,6 +112,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
connect(ui->toolButton_update, &QToolButton::clicked, this, [=] { runOnNewThread([=] { CheckUpdate(); }); });
// Setup log UI
ui->splitter->restoreState(DecodeB64IfValid(NekoRay::dataStore->splitter_state));
new SyntaxHighlighter(false, qvLogDocument);
qvLogDocument->setUndoRedoEnabled(false);
ui->masterLogBrowser->setUndoRedoEnabled(false);
@@ -588,20 +589,24 @@ void MainWindow::on_menu_hotkey_settings_triggered() {
void MainWindow::on_commitDataRequest() {
qDebug() << "Start of data save";
//
if (!isMaximized()) {
auto olds = NekoRay::dataStore->mw_size;
auto news = QString("%1x%2").arg(size().width()).arg(size().height());
if (olds != news) {
NekoRay::dataStore->mw_size = news;
NekoRay::dataStore->Save();
}
}
//
NekoRay::dataStore->splitter_state = ui->splitter->saveState().toBase64();
//
auto last_id = NekoRay::dataStore->started_id;
neko_stop();
if (NekoRay::dataStore->remember_enable && last_id >= 0) {
NekoRay::dataStore->UpdateStartedId(last_id);
NekoRay::dataStore->remember_id = last_id;
}
//
NekoRay::dataStore->Save();
qDebug() << "End of data save";
}
@@ -1497,7 +1502,6 @@ void MainWindow::on_masterLogBrowser_customContextMenuRequested(const QPoint &po
bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
if (event->type() == QEvent::MouseButtonPress) {
auto mouseEvent = dynamic_cast<QMouseEvent *>(event);
if (obj == ui->label_running && mouseEvent->button() == Qt::LeftButton && running != nullptr) {
speedtest_current();
return true;