Skip to content

Commit

Permalink
No longer holds previous window state in settings due to bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ripose committed Apr 18, 2021
1 parent 7056c8d commit 90bcf0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
23 changes: 2 additions & 21 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
#include <QSettings>
#include <QStyleFactory>

#define SETTINGS_WINDOW_GROUP "window"
#define SETTINGS_WINDOW_GEOMETRY "geometry"
#define SETTINGS_WINDOW_STATE "state"

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
m_mediator(GlobalMediator::createGlobalMedaitor()),
Expand Down Expand Up @@ -243,25 +239,8 @@ MainWindow::~MainWindow()
delete m_ankiClient;
}

void MainWindow::closeEvent(QCloseEvent *event)
{
QSettings settings;
settings.beginGroup(SETTINGS_WINDOW_GROUP);
settings.setValue(SETTINGS_WINDOW_GEOMETRY, saveGeometry());
settings.setValue(SETTINGS_WINDOW_STATE, saveState());
QMainWindow::closeEvent(event);
}

void MainWindow::showEvent(QShowEvent *event)
{
/* Restore Window Settings */
QSettings settings;
settings.beginGroup(SETTINGS_WINDOW_GROUP);
restoreGeometry(settings.value(SETTINGS_WINDOW_GEOMETRY).toByteArray());
restoreState(settings.value(SETTINGS_WINDOW_STATE).toByteArray());
settings.endGroup();
m_maximized = isMaximized();

/* Load files opened with Memento */
QStringList args = QApplication::arguments();
if (args.size() > 1)
Expand All @@ -284,6 +263,8 @@ void MainWindow::showEvent(QShowEvent *event)
"To install a dictionary, go to Settings -> Options -> Dictionaries."
);
}

QMainWindow::showEvent(event);
}

void MainWindow::keyPressEvent(QKeyEvent *event)
Expand Down
1 change: 0 additions & 1 deletion src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ private Q_SLOTS:
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;

private:
Ui::MainWindow *m_ui;
Expand Down

0 comments on commit 90bcf0f

Please sign in to comment.