Mercurial > minori
diff 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 |
line wrap: on
line diff
--- a/src/gui/window.cpp Mon Oct 02 07:06:44 2023 -0400 +++ b/src/gui/window.cpp Mon Oct 02 21:33:25 2023 -0400 @@ -22,11 +22,13 @@ #include <QFile> #include <QMainWindow> #include <QMenuBar> +#include <QToolBar> #include <QMessageBox> #include <QPlainTextEdit> #include <QStackedWidget> #include <QTextStream> #include <QTimer> +#include <QHBoxLayout> #if MACOSX # include "sys/osx/dark_theme.h" #elif defined(WIN32) @@ -194,6 +196,19 @@ setMenuBar(menubar); + /* Toolbar */ + QToolBar* toolbar = new QToolBar(this); + toolbar->addAction(QIcon(":/icons/24x24/arrow-circle-double-135.png"), tr("&Synchronize"), [stack] { + Services::Synchronize(); + reinterpret_cast<AnimeListPage*>(stack->widget(static_cast<int>(Pages::ANIME_LIST)))->Refresh(); + }); + toolbar->addSeparator(); + toolbar->addAction(QIcon(":/icons/24x24/gear.png"), tr("S&ettings"), [this]{ + SettingsDialog dialog(this); + dialog.exec(); + }); + addToolBar(toolbar); + QHBoxLayout* layout = new QHBoxLayout(main_widget); layout->addWidget(sidebar); layout->addWidget(stack);