Mercurial > minori
comparison src/gui/window.cpp @ 68:2417121d894e
*: normalize usage of layouts
before, I used them two ways, once was by setting the layout later
by using setLayout(QWidget), and the other was just using the constructor.
I find the constructor to be easier to read, so I chose that one.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 02 Oct 2023 21:33:25 -0400 |
parents | fe719c109dbc |
children | 27a19dd6cba1 |
comparison
equal
deleted
inserted
replaced
67:442065432549 | 68:2417121d894e |
---|---|
20 #include <QApplication> | 20 #include <QApplication> |
21 #include <QDebug> | 21 #include <QDebug> |
22 #include <QFile> | 22 #include <QFile> |
23 #include <QMainWindow> | 23 #include <QMainWindow> |
24 #include <QMenuBar> | 24 #include <QMenuBar> |
25 #include <QToolBar> | |
25 #include <QMessageBox> | 26 #include <QMessageBox> |
26 #include <QPlainTextEdit> | 27 #include <QPlainTextEdit> |
27 #include <QStackedWidget> | 28 #include <QStackedWidget> |
28 #include <QTextStream> | 29 #include <QTextStream> |
29 #include <QTimer> | 30 #include <QTimer> |
31 #include <QHBoxLayout> | |
30 #if MACOSX | 32 #if MACOSX |
31 # include "sys/osx/dark_theme.h" | 33 # include "sys/osx/dark_theme.h" |
32 #elif defined(WIN32) | 34 #elif defined(WIN32) |
33 # include "sys/win32/dark_theme.h" | 35 # include "sys/win32/dark_theme.h" |
34 #endif | 36 #endif |
192 action = menu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); | 194 action = menu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); |
193 action->setMenuRole(QAction::AboutQtRole); | 195 action->setMenuRole(QAction::AboutQtRole); |
194 | 196 |
195 setMenuBar(menubar); | 197 setMenuBar(menubar); |
196 | 198 |
199 /* Toolbar */ | |
200 QToolBar* toolbar = new QToolBar(this); | |
201 toolbar->addAction(QIcon(":/icons/24x24/arrow-circle-double-135.png"), tr("&Synchronize"), [stack] { | |
202 Services::Synchronize(); | |
203 reinterpret_cast<AnimeListPage*>(stack->widget(static_cast<int>(Pages::ANIME_LIST)))->Refresh(); | |
204 }); | |
205 toolbar->addSeparator(); | |
206 toolbar->addAction(QIcon(":/icons/24x24/gear.png"), tr("S&ettings"), [this]{ | |
207 SettingsDialog dialog(this); | |
208 dialog.exec(); | |
209 }); | |
210 addToolBar(toolbar); | |
211 | |
197 QHBoxLayout* layout = new QHBoxLayout(main_widget); | 212 QHBoxLayout* layout = new QHBoxLayout(main_widget); |
198 layout->addWidget(sidebar); | 213 layout->addWidget(sidebar); |
199 layout->addWidget(stack); | 214 layout->addWidget(stack); |
200 setCentralWidget(main_widget); | 215 setCentralWidget(main_widget); |
201 | 216 |