mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Window position and size is remembered
Position and size of the window is saved and restored on startup.
This commit is contained in:
parent
324b1e0ab4
commit
495e8e5db5
@ -124,6 +124,7 @@ void KiwixApp::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
restoreTabs();
|
restoreTabs();
|
||||||
|
restoreWindowState();
|
||||||
}
|
}
|
||||||
|
|
||||||
KiwixApp::~KiwixApp()
|
KiwixApp::~KiwixApp()
|
||||||
@ -557,3 +558,15 @@ void KiwixApp::saveListOfOpenTabs()
|
|||||||
{
|
{
|
||||||
return mp_session->setValue("reopenTabList", getTabWidget()->getTabUrls());
|
return mp_session->setValue("reopenTabList", getTabWidget()->getTabUrls());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KiwixApp::saveWindowState()
|
||||||
|
{
|
||||||
|
mp_session->setValue("geometry", getMainWindow()->saveGeometry());
|
||||||
|
mp_session->setValue("windowState", getMainWindow()->saveState());
|
||||||
|
}
|
||||||
|
|
||||||
|
void KiwixApp::restoreWindowState()
|
||||||
|
{
|
||||||
|
getMainWindow()->restoreGeometry(mp_session->value("geometry").toByteArray());
|
||||||
|
getMainWindow()->restoreState(mp_session->value("windowState").toByteArray());
|
||||||
|
}
|
||||||
|
@ -89,6 +89,8 @@ public:
|
|||||||
bool isCurrentArticleBookmarked();
|
bool isCurrentArticleBookmarked();
|
||||||
QString parseStyleFromFile(QString filePath);
|
QString parseStyleFromFile(QString filePath);
|
||||||
void saveListOfOpenTabs();
|
void saveListOfOpenTabs();
|
||||||
|
void saveWindowState();
|
||||||
|
void restoreWindowState();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void newTab();
|
void newTab();
|
||||||
|
@ -119,6 +119,12 @@ bool MainWindow::eventFilter(QObject* /*object*/, QEvent* event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
KiwixApp::instance()->saveWindowState();
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::readingListToggled(bool state)
|
void MainWindow::readingListToggled(bool state)
|
||||||
{
|
{
|
||||||
if (state) {
|
if (state) {
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject* object, QEvent* event) override;
|
bool eventFilter(QObject* object, QEvent* event) override;
|
||||||
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggleFullScreen();
|
void toggleFullScreen();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user