Mercurial > minori
annotate src/gui/window.cc @ 261:3ec7804abf17
include: make header guards more sane
The C++ standard[1] says:
	Each identifier that contains a double underscore __ or
	begins with an underscore followed by an uppercase letter
	is reserved to the implementation for any use.
[1]: https://timsong-cpp.github.io/cppwp/n4659/lex.name#3.1
| author | Paper <paper@paper.us.eu.org> | 
|---|---|
| date | Wed, 03 Apr 2024 20:04:28 -0400 | 
| parents | 862d0d8619f6 | 
| children | f31305b9f60a | 
| rev | line source | 
|---|---|
| 9 | 1 #include "gui/window.h" | 
| 64 | 2 #include "core/anime_db.h" | 
| 9 | 3 #include "core/config.h" | 
| 4 #include "core/session.h" | |
| 64 | 5 #include "core/strings.h" | 
| 62 | 6 #include "gui/dialog/about.h" | 
| 9 | 7 #include "gui/dialog/settings.h" | 
| 8 #include "gui/pages/anime_list.h" | |
| 62 | 9 #include "gui/pages/history.h" | 
| 9 | 10 #include "gui/pages/now_playing.h" | 
| 62 | 11 #include "gui/pages/search.h" | 
| 12 #include "gui/pages/seasons.h" | |
| 9 | 13 #include "gui/pages/statistics.h" | 
| 
54
 
466ac9870df9
add stub pages (to be implemented)
 
Paper <mrpapersonic@gmail.com> 
parents: 
51 
diff
changeset
 | 
14 #include "gui/pages/torrents.h" | 
| 258 | 15 #include "gui/theme.h" | 
| 46 | 16 #include "gui/widgets/sidebar.h" | 
| 258 | 17 #include "library/library.h" | 
| 15 | 18 #include "services/services.h" | 
| 64 | 19 #include "track/media.h" | 
| 
147
 
6fdf0632c003
track: use a bit of a more sane way to manage recognition
 
Paper <mrpapersonic@gmail.com> 
parents: 
139 
diff
changeset
 | 
20 | 
| 154 | 21 #include "anitomy/anitomy.h" | 
| 22 | |
| 63 | 23 #include <QActionGroup> | 
| 7 | 24 #include <QApplication> | 
| 64 | 25 #include <QDebug> | 
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
26 #include <QDesktopServices> | 
| 9 | 27 #include <QFile> | 
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
28 #include <QFileDialog> | 
| 69 | 29 #include <QHBoxLayout> | 
| 7 | 30 #include <QMainWindow> | 
| 31 #include <QMenuBar> | |
| 63 | 32 #include <QMessageBox> | 
| 7 | 33 #include <QPlainTextEdit> | 
| 34 #include <QStackedWidget> | |
| 63 | 35 #include <QTextStream> | 
| 
168
 
79a2a24453fa
window: improve performance when getting running files
 
paper@DavesDouble.local 
parents: 
154 
diff
changeset
 | 
36 #include <QThread> | 
| 77 | 37 #include <QThreadPool> | 
| 62 | 38 #include <QTimer> | 
| 69 | 39 #include <QToolBar> | 
| 40 #include <QToolButton> | |
| 
147
 
6fdf0632c003
track: use a bit of a more sane way to manage recognition
 
Paper <mrpapersonic@gmail.com> 
parents: 
139 
diff
changeset
 | 
41 | 
| 
190
 
2d5823df870f
dep/animia: finalize de-objc-ifying quartz
 
Paper <mrpapersonic@gmail.com> 
parents: 
174 
diff
changeset
 | 
42 #include <iostream> | 
| 
 
2d5823df870f
dep/animia: finalize de-objc-ifying quartz
 
Paper <mrpapersonic@gmail.com> 
parents: 
174 
diff
changeset
 | 
43 | 
| 
106
 
c8c72278f6fd
*: #if -> #ifdef, remove outdated comments in sys/win32/dark_theme.cc
 
Paper <mrpapersonic@gmail.com> 
parents: 
105 
diff
changeset
 | 
44 #ifdef MACOSX | 
| 15 | 45 # include "sys/osx/dark_theme.h" | 
| 237 | 46 # include "sys/osx/permissions.h" | 
| 46 | 47 #elif defined(WIN32) | 
| 15 | 48 # include "sys/win32/dark_theme.h" | 
| 2 | 49 #endif | 
| 50 | |
| 
170
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
51 void PlayingThread::run() { | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
52 std::vector<std::string> files; | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
53 Track::Media::GetCurrentlyPlaying(files); | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
54 emit Done(files); | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
55 } | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
56 | 
| 9 | 57 MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { | 
| 
241
 
06d6c351925c
*: reorganize resources, +docs, build translations with autotools
 
Paper <paper@paper.us.eu.org> 
parents: 
237 
diff
changeset
 | 
58 setWindowIcon(QIcon(":/icons/favicon.png")); | 
| 103 | 59 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
60 main_widget.reset(new QWidget(this)); | 
| 
190
 
2d5823df870f
dep/animia: finalize de-objc-ifying quartz
 
Paper <mrpapersonic@gmail.com> 
parents: 
174 
diff
changeset
 | 
61 new QHBoxLayout(main_widget.get()); | 
| 10 | 62 | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
63 AddMainWidgets(); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
64 setCentralWidget(main_widget.get()); | 
| 79 | 65 | 
| 66 CreateBars(); | |
| 67 | |
| 
168
 
79a2a24453fa
window: improve performance when getting running files
 
paper@DavesDouble.local 
parents: 
154 
diff
changeset
 | 
68 NowPlayingPage* page = reinterpret_cast<NowPlayingPage*>(stack->widget(static_cast<int>(Pages::NOW_PLAYING))); | 
| 79 | 69 | 
| 
168
 
79a2a24453fa
window: improve performance when getting running files
 
paper@DavesDouble.local 
parents: 
154 
diff
changeset
 | 
70 qRegisterMetaType<std::vector<std::string>>(); | 
| 79 | 71 | 
| 
195
 
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
 
Paper <mrpapersonic@gmail.com> 
parents: 
190 
diff
changeset
 | 
72 /* This thread will be destroyed on | 
| 
 
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
 
Paper <mrpapersonic@gmail.com> 
parents: 
190 
diff
changeset
 | 
73 * close of the program OR on the destruction | 
| 
 
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
 
Paper <mrpapersonic@gmail.com> 
parents: 
190 
diff
changeset
 | 
74 * of MainWindow | 
| 258 | 75 */ | 
| 
170
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
76 thread.reset(new PlayingThread(this)); | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
77 | 
| 
232
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
78 connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
79 for (const auto& file : files) { | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
80 anitomy::Anitomy anitomy; | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
81 anitomy.Parse(Strings::ToWstring(file)); | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
82 | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
83 const auto& elements = anitomy.elements(); | 
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
84 const std::string title = Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); | 
| 
232
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
85 | 
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
86 int id = Anime::db.GetAnimeFromTitle(title); | 
| 
232
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
87 if (id <= 0) | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
88 continue; | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
89 | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
90 page->SetPlaying(Anime::db.items[id], elements); | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
91 break; | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
92 } | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
93 }); | 
| 
 
ff0061e75f0f
theme: add OS detection with glib
 
Paper <mrpapersonic@gmail.com> 
parents: 
228 
diff
changeset
 | 
94 | 
| 
190
 
2d5823df870f
dep/animia: finalize de-objc-ifying quartz
 
Paper <mrpapersonic@gmail.com> 
parents: 
174 
diff
changeset
 | 
95 QTimer* timer = new QTimer(this); | 
| 154 | 96 | 
| 
168
 
79a2a24453fa
window: improve performance when getting running files
 
paper@DavesDouble.local 
parents: 
154 
diff
changeset
 | 
97 connect(timer, &QTimer::timeout, this, [this, page] { | 
| 
170
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
98 if (!thread.get() || thread->isRunning()) | 
| 
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
99 return; | 
| 
190
 
2d5823df870f
dep/animia: finalize de-objc-ifying quartz
 
Paper <mrpapersonic@gmail.com> 
parents: 
174 
diff
changeset
 | 
100 | 
| 
168
 
79a2a24453fa
window: improve performance when getting running files
 
paper@DavesDouble.local 
parents: 
154 
diff
changeset
 | 
101 thread->start(); | 
| 79 | 102 }); | 
| 
170
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
103 | 
| 237 | 104 #ifdef MACOSX | 
| 105 if (!osx::AskForPermissions()) | |
| 106 return; | |
| 107 #endif | |
| 108 | |
| 
170
 
c8375765f0fc
window: make threading somewhat sane
 
Paper <mrpapersonic@gmail.com> 
parents: 
168 
diff
changeset
 | 
109 timer->start(5000); | 
| 79 | 110 } | 
| 111 | |
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
112 void MainWindow::AddMainWidgets() { | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
113 int page = static_cast<int>(Pages::ANIME_LIST); | 
| 250 | 114 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
115 if (sidebar.get()) { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
116 main_widget->layout()->removeWidget(sidebar.get()); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
117 sidebar.reset(); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
118 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
119 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
120 if (stack.get()) { | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
121 page = stack->currentIndex(); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
122 main_widget->layout()->removeWidget(stack.get()); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
123 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
124 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
125 sidebar.reset(new SideBar(main_widget.get())); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
126 sidebar->setFixedWidth(128); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
127 sidebar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
128 | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
129 sidebar->AddItem(tr("Now Playing"), SideBar::CreateIcon(":/icons/16x16/film.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
130 sidebar->AddSeparator(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
131 sidebar->AddItem(tr("Anime List"), SideBar::CreateIcon(":/icons/16x16/document-list.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
132 sidebar->AddItem(tr("History"), SideBar::CreateIcon(":/icons/16x16/clock-history-frame.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
133 sidebar->AddItem(tr("Statistics"), SideBar::CreateIcon(":/icons/16x16/chart.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
134 sidebar->AddSeparator(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
135 sidebar->AddItem(tr("Search"), SideBar::CreateIcon(":/icons/16x16/magnifier.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
136 sidebar->AddItem(tr("Seasons"), SideBar::CreateIcon(":/icons/16x16/calendar.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
137 sidebar->AddItem(tr("Torrents"), SideBar::CreateIcon(":/icons/16x16/feed.png")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
138 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
139 stack.reset(new QStackedWidget(main_widget.get())); | 
| 250 | 140 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
141 stack->addWidget(new NowPlayingPage(main_widget.get())); | 
| 250 | 142 /* ---- */ | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
143 stack->addWidget(new AnimeListPage(main_widget.get())); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
144 stack->addWidget(new HistoryPage(main_widget.get())); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
145 stack->addWidget(new StatisticsPage(main_widget.get())); | 
| 250 | 146 /* ---- */ | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
147 stack->addWidget(new SearchPage(main_widget.get())); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
148 stack->addWidget(new SeasonsPage(main_widget.get())); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
149 stack->addWidget(new TorrentsPage(main_widget.get())); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
150 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
151 connect(sidebar.get(), &SideBar::CurrentItemChanged, stack.get(), &QStackedWidget::setCurrentIndex); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
152 sidebar->SetCurrentItem(page); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
153 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
154 main_widget->layout()->addWidget(sidebar.get()); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
155 main_widget->layout()->addWidget(stack.get()); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
156 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
157 | 
| 79 | 158 void MainWindow::CreateBars() { | 
| 159 QMenuBar* menubar = new QMenuBar(this); | |
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
160 QAction* sync_action; | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
161 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
162 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
163 /* File */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
164 QMenu* menu = menubar->addMenu(tr("&File")); | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
165 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
166 { | 
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
167 folder_menu = menu->addMenu(tr("&Library folders")); | 
| 
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
168 | 
| 250 | 169 UpdateFolderMenu(); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
170 } | 
| 2 | 171 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
172 { | 
| 258 | 173 menu->addAction(tr("&Scan available episodes"), [] { Library::SearchLibraryFolders(); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
174 } | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
175 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
176 menu->addSeparator(); | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
177 | 
| 258 | 178 // { | 
| 179 // QAction* action = menu->addAction(tr("Play &next episode")); | |
| 180 // action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N)); | |
| 181 // } | |
| 182 // | |
| 183 // { | |
| 184 // QAction* action = menu->addAction(tr("Play &random episode")); | |
| 185 // action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_R)); | |
| 186 // } | |
| 2 | 187 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
188 menu->addSeparator(); | 
| 2 | 189 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
190 { | 
| 250 | 191 QAction* action = menu->addAction(tr("E&xit"), this, &MainWindow::close); | 
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
192 action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q)); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
193 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
194 } | 
| 2 | 195 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
196 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
197 /* Services */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
198 QMenu* menu = menubar->addMenu(tr("&Services")); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
199 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
200 { | 
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
201 sync_action = menu->addAction(tr("Synchronize &list")); | 
| 
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
202 | 
| 258 | 203 connect(sync_action, &QAction::triggered, this, | 
| 204 [this, sync_action] { AsyncSynchronize(sync_action, stack.get()); }); | |
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
205 | 
| 
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
206 sync_action->setIcon(QIcon(":/icons/24x24/arrow-circle-double-135.png")); | 
| 
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
207 sync_action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S)); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
208 } | 
| 2 | 209 | 
| 258 | 210 // menu->addSeparator(); | 
| 211 // | |
| 212 // { | |
| 213 // /* AniList */ | |
| 214 // QMenu* submenu = menu->addMenu(tr("&AniList")); | |
| 215 // QAction* action = submenu->addAction(tr("Go to my &profile")); | |
| 216 // action = submenu->addAction(tr("Go to my &stats")); | |
| 217 // } | |
| 218 // | |
| 219 // { | |
| 220 // /* Kitsu */ | |
| 221 // QMenu* submenu = menu->addMenu(tr("&Kitsu")); | |
| 222 // QAction* action = submenu->addAction(tr("Go to my &feed")); | |
| 223 // action = submenu->addAction(tr("Go to my &library")); | |
| 224 // action = submenu->addAction(tr("Go to my &profile")); | |
| 225 // } | |
| 226 // { | |
| 227 // QMenu* submenu = menu->addMenu(tr("&MyAnimeList")); | |
| 228 // QAction* action = submenu->addAction(tr("Go to my p&anel")); | |
| 229 // action = submenu->addAction(tr("Go to my &profile")); | |
| 230 // action = submenu->addAction(tr("Go to my &history")); | |
| 231 // } | |
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
232 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
233 } | 
| 2 | 234 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
235 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
236 /* Tools */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
237 QMenu* menu = menubar->addMenu(tr("&Tools")); | 
| 258 | 238 // { | 
| 239 // /* Export anime list */ | |
| 240 // QMenu* submenu = menu->addMenu(tr("&Export anime list")); | |
| 241 // | |
| 242 // { | |
| 243 // /* Markdown export */ | |
| 244 // QAction* action = submenu->addAction(tr("Export as &Markdown...")); | |
| 245 // } | |
| 246 // | |
| 247 // { | |
| 248 // /* XML export */ | |
| 249 // QAction* action = submenu->addAction(tr("Export as MyAnimeList &XML...")); | |
| 250 // } | |
| 251 // } | |
| 252 // menu->addSeparator(); | |
| 253 // | |
| 254 // { | |
| 255 // QAction* action = menu->addAction(tr("Enable anime &recognition")); | |
| 256 // action->setCheckable(true); | |
| 257 // } | |
| 258 // | |
| 259 // { | |
| 260 // QAction* action = menu->addAction(tr("Enable auto &sharing")); | |
| 261 // action->setCheckable(true); | |
| 262 // } | |
| 263 // | |
| 264 // { | |
| 265 // QAction* action = menu->addAction(tr("Enable &auto synchronization")); | |
| 266 // action->setCheckable(true); | |
| 267 // } | |
| 268 // | |
| 269 // menu->addSeparator(); | |
| 
44
 
619cbd6e69f9
filesystem: fix CreateDirectories function
 
Paper <mrpapersonic@gmail.com> 
parents: 
37 
diff
changeset
 | 
270 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
271 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
272 QAction* action = menu->addAction(tr("&Settings"), [this] { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
273 SettingsDialog dialog(this); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
274 dialog.exec(); | 
| 250 | 275 UpdateFolderMenu(); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
276 }); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
277 action->setMenuRole(QAction::PreferencesRole); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
278 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
279 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
280 | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
281 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
282 /* View */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
283 QMenu* menu = menubar->addMenu(tr("&View")); | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
284 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
285 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
286 /* Pages... */ | 
| 250 | 287 QActionGroup* pages_group = new QActionGroup(menu); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
288 pages_group->setExclusive(true); | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
289 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
290 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
291 QAction* action = pages_group->addAction(menu->addAction(tr("&Now Playing"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
292 action->setCheckable(true); | 
| 258 | 293 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(0); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
294 } | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
295 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
296 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
297 QAction* action = pages_group->addAction(menu->addAction(tr("&Anime List"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
298 action->setCheckable(true); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
299 action->setChecked(true); | 
| 258 | 300 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(1); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
301 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
302 | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
303 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
304 QAction* action = pages_group->addAction(menu->addAction(tr("&History"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
305 action->setCheckable(true); | 
| 258 | 306 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(2); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
307 } | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
308 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
309 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
310 QAction* action = pages_group->addAction(menu->addAction(tr("&Statistics"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
311 action->setCheckable(true); | 
| 258 | 312 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(3); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
313 } | 
| 
48
 
e613772f41d5
statistics.cpp: show requests made
 
Paper <mrpapersonic@gmail.com> 
parents: 
46 
diff
changeset
 | 
314 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
315 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
316 QAction* action = pages_group->addAction(menu->addAction(tr("S&earch"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
317 action->setCheckable(true); | 
| 258 | 318 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(4); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
319 } | 
| 
44
 
619cbd6e69f9
filesystem: fix CreateDirectories function
 
Paper <mrpapersonic@gmail.com> 
parents: 
37 
diff
changeset
 | 
320 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
321 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
322 QAction* action = pages_group->addAction(menu->addAction(tr("Se&asons"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
323 action->setCheckable(true); | 
| 258 | 324 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(5); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
325 } | 
| 
54
 
466ac9870df9
add stub pages (to be implemented)
 
Paper <mrpapersonic@gmail.com> 
parents: 
51 
diff
changeset
 | 
326 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
327 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
328 QAction* action = pages_group->addAction(menu->addAction(tr("&Torrents"))); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
329 action->setCheckable(true); | 
| 258 | 330 connect(action, &QAction::toggled, this, [this] { sidebar->SetCurrentItem(6); }); | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
331 } | 
| 
54
 
466ac9870df9
add stub pages (to be implemented)
 
Paper <mrpapersonic@gmail.com> 
parents: 
51 
diff
changeset
 | 
332 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
333 /* pain in my ass */ | 
| 250 | 334 connect(sidebar.get(), &SideBar::CurrentItemChanged, this, [pages_group](int index) { | 
| 335 QAction* checked = pages_group->checkedAction(); | |
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
336 | 
| 250 | 337 const QList<QAction*>& actions = pages_group->actions(); | 
| 338 if (index > actions.size()) | |
| 339 return; | |
| 340 | |
| 341 if (checked) | |
| 342 checked->setChecked(false); | |
| 343 actions[index]->setChecked(true); | |
| 344 }); | |
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
345 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
346 | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
347 menu->addSeparator(); | 
| 
44
 
619cbd6e69f9
filesystem: fix CreateDirectories function
 
Paper <mrpapersonic@gmail.com> 
parents: 
37 
diff
changeset
 | 
348 | 
| 258 | 349 // { | 
| 350 // QAction* action = menu->addAction(tr("Show sidebar")); | |
| 351 // } | |
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
352 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
353 | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
354 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
355 /* Help */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
356 QMenu* menu = menubar->addMenu(tr("&Help")); | 
| 2 | 357 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
358 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
359 /* About Minori */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
360 menu->addAction(tr("&About Minori"), this, [this] { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
361 AboutWindow dialog(this); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
362 dialog.exec(); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
363 }); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
364 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
365 | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
366 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
367 /* About Qt */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
368 QAction* action = menu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
369 action->setMenuRole(QAction::AboutQtRole); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
370 } | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
371 } | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
372 /* QMainWindow will delete the old one for us, | 
| 255 | 373 * according to the docs | 
| 258 | 374 */ | 
| 2 | 375 setMenuBar(menubar); | 
| 7 | 376 | 
| 
68
 
2417121d894e
*: normalize usage of layouts
 
Paper <mrpapersonic@gmail.com> 
parents: 
64 
diff
changeset
 | 
377 /* Toolbar */ | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
378 | 
| 79 | 379 /* remove old toolbar(s) */ | 
| 115 | 380 /* the empty QString() is a Qt 5 wart... */ | 
| 381 for (QToolBar*& t : findChildren<QToolBar*>(QString(), Qt::FindDirectChildrenOnly)) { | |
| 79 | 382 removeToolBar(t); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
383 delete t; | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
384 } | 
| 79 | 385 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
386 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
387 /* Toolbar */ | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
388 QToolBar* toolbar = new QToolBar(this); | 
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
389 toolbar->addAction(sync_action); | 
| 69 | 390 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
391 toolbar->addSeparator(); | 
| 69 | 392 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
393 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
394 QToolButton* button = new QToolButton(toolbar); | 
| 258 | 395 { button->setMenu(folder_menu); } | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
396 button->setIcon(QIcon(":/icons/24x24/folder-open.png")); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
397 button->setPopupMode(QToolButton::InstantPopup); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
398 toolbar->addWidget(button); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
399 } | 
| 69 | 400 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
401 { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
402 QToolButton* button = new QToolButton(toolbar); | 
| 69 | 403 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
404 { | 
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
405 /* links */ | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
406 QMenu* menu = new QMenu(button); | 
| 258 | 407 menu->addAction("Hibari", [] { QDesktopServices::openUrl(QUrl("https://hb.wopian.me/")); }); | 
| 408 menu->addAction("MALgraph", [] { QDesktopServices::openUrl(QUrl("https://graph.anime.plus/")); }); | |
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
409 menu->addSeparator(); | 
| 258 | 410 menu->addAction("AniChart", [] { QDesktopServices::openUrl(QUrl("https://anichart.net/airing")); }); | 
| 411 menu->addAction("Monthly.moe", | |
| 412 [] { QDesktopServices::openUrl(QUrl("https://www.monthly.moe/weekly")); }); | |
| 413 menu->addAction("Senpai Anime Charts", | |
| 414 [] { QDesktopServices::openUrl(QUrl("https://www.senpai.moe/?mode=calendar")); }); | |
| 
223
 
84e0a3c4737a
library: implement menu bar buttons
 
Paper <mrpapersonic@gmail.com> 
parents: 
195 
diff
changeset
 | 
415 menu->addSeparator(); | 
| 258 | 416 menu->addAction("Anime Streaming Search Engine", | 
| 417 [] { QDesktopServices::openUrl(QUrl("https://because.moe/")); }); | |
| 418 menu->addAction("The Fansub Database", [] { QDesktopServices::openUrl(QUrl("https://fansubdb.com")); }); | |
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
419 | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
420 button->setMenu(menu); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
421 } | 
| 69 | 422 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
423 button->setIcon(QIcon(":/icons/24x24/application-export.png")); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
424 button->setPopupMode(QToolButton::InstantPopup); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
425 toolbar->addWidget(button); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
426 } | 
| 69 | 427 | 
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
428 toolbar->addSeparator(); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
429 toolbar->addAction(QIcon(":/icons/24x24/gear.png"), tr("S&ettings"), [this] { | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
430 SettingsDialog dialog(this); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
431 dialog.exec(); | 
| 250 | 432 /* library folders might have changed! */ | 
| 433 UpdateFolderMenu(); | |
| 
114
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
434 }); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
435 addToolBar(toolbar); | 
| 
 
ab191e28e69d
*: add initial torrent stuff
 
Paper <mrpapersonic@gmail.com> 
parents: 
113 
diff
changeset
 | 
436 } | 
| 2 | 437 } | 
| 438 | |
| 250 | 439 void MainWindow::UpdateFolderMenu() { | 
| 440 if (!folder_menu) | |
| 441 return; | |
| 442 | |
| 443 folder_menu->clear(); | |
| 444 | |
| 445 /* add in all of our existing folders... */ | |
| 446 std::size_t i = 0; | |
| 447 for (const auto& path : session.config.library.paths) { | |
| 448 const QString folder = Strings::ToQString(path); | |
| 258 | 449 QAction* action = | 
| 450 folder_menu->addAction(folder, [folder] { QDesktopServices::openUrl(QUrl::fromLocalFile(folder)); }); | |
| 250 | 451 | 
| 452 if (i < 9) { | |
| 453 /* Qt::Key_1 is equivalent to 1 in ASCII, so we can use the same | |
| 454 * stupid `'0' + i` trick here | |
| 258 | 455 */ | 
| 250 | 456 action->setShortcut(QKeySequence(Qt::ALT | static_cast<Qt::Modifier>(Qt::Key_1 + i))); | 
| 457 } else if (i == 9) { | |
| 458 action->setShortcut(QKeySequence(Qt::ALT | Qt::Key_0)); | |
| 459 } | |
| 460 /* don't bother with a shortcut in case of more... */ | |
| 461 i++; | |
| 462 } | |
| 463 | |
| 464 folder_menu->addSeparator(); | |
| 465 | |
| 466 { | |
| 258 | 467 folder_menu->addAction(tr("&Add new folder..."), [this] { | 
| 468 const QString dir = | |
| 469 QFileDialog::getExistingDirectory(this, tr("Open Directory"), QDir::homePath(), | |
| 470 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); | |
| 250 | 471 if (dir.isEmpty()) | 
| 472 return; | |
| 473 session.config.library.paths.insert(Strings::ToUtf8String(dir)); | |
| 474 UpdateFolderMenu(); | |
| 475 }); | |
| 476 } | |
| 477 } | |
| 478 | |
| 2 | 479 void MainWindow::SetActivePage(QWidget* page) { | 
| 480 this->setCentralWidget(page); | |
| 481 } | |
| 482 | |
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
483 void MainWindow::AsyncSynchronize(QAction* action, QStackedWidget* stack) { | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
484 if (session.config.service == Anime::Services::NONE) { | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
485 QMessageBox msg; | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
486 msg.setWindowTitle(tr("Error synchronizing with service!")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
487 msg.setText(tr("It seems you haven't yet selected a service to use.")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
488 msg.setInformativeText(tr("Would you like to select one now?")); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
489 msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
490 msg.setDefaultButton(QMessageBox::Yes); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
491 int ret = msg.exec(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
492 if (ret == QMessageBox::Yes) { | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
493 SettingsDialog dialog; | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
494 dialog.exec(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
495 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
496 } | 
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
497 | 
| 
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
498 QThreadPool::globalInstance()->start([stack, action] { | 
| 
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
499 action->setEnabled(false); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
500 Services::Synchronize(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
501 reinterpret_cast<AnimeListPage*>(stack->widget(static_cast<int>(Pages::ANIME_LIST)))->Refresh(); | 
| 
236
 
4d461ef7d424
HUGE UPDATE: convert build system to autotools
 
Paper <mrpapersonic@gmail.com> 
parents: 
232 
diff
changeset
 | 
502 action->setEnabled(true); | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
503 }); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
504 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
505 | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
506 void MainWindow::RetranslateUI() { | 
| 
113
 
32afe0e940bf
window: remove tiny little debug thing
 
Paper <mrpapersonic@gmail.com> 
parents: 
112 
diff
changeset
 | 
507 /* This kinda sucks but nobody's really going to be changing | 
| 
 
32afe0e940bf
window: remove tiny little debug thing
 
Paper <mrpapersonic@gmail.com> 
parents: 
112 
diff
changeset
 | 
508 the application language all the time :p */ | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
509 setUpdatesEnabled(false); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
510 AddMainWidgets(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
511 CreateBars(); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
512 setUpdatesEnabled(true); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
513 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
514 | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
515 void MainWindow::changeEvent(QEvent* event) { | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
516 if (event) { /* is this really necessary */ | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
517 switch (event->type()) { | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
518 // this event is send if a translator is loaded | 
| 258 | 519 case QEvent::LanguageChange: RetranslateUI(); break; | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
520 | 
| 258 | 521 default: break; | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
522 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
523 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
524 QMainWindow::changeEvent(event); | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
525 } | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
526 | 
| 
105
 
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
 
Paper <mrpapersonic@gmail.com> 
parents: 
103 
diff
changeset
 | 
527 void MainWindow::showEvent(QShowEvent* event) { | 
| 
 
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
 
Paper <mrpapersonic@gmail.com> 
parents: 
103 
diff
changeset
 | 
528 QMainWindow::showEvent(event); | 
| 
 
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
 
Paper <mrpapersonic@gmail.com> 
parents: 
103 
diff
changeset
 | 
529 #ifdef WIN32 | 
| 
112
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
530 /* Technically this *should* be | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
531 session.config.theme.IsInDarkTheme() && win32::IsInDarkTheme() | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
532 but I prefer the title bar being black even when light mode | 
| 
 
80f49f623d30
locale: allow switching locales without restarting
 
Paper <mrpapersonic@gmail.com> 
parents: 
108 
diff
changeset
 | 
533 is enabled :/ */ | 
| 108 | 534 win32::SetTitleBarsToBlack(session.config.theme.IsInDarkTheme()); | 
| 
105
 
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
 
Paper <mrpapersonic@gmail.com> 
parents: 
103 
diff
changeset
 | 
535 #endif | 
| 
 
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
 
Paper <mrpapersonic@gmail.com> 
parents: 
103 
diff
changeset
 | 
536 } | 
| 
 
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
 
Paper <mrpapersonic@gmail.com> 
parents: 
103 
diff
changeset
 | 
537 | 
| 2 | 538 void MainWindow::closeEvent(QCloseEvent* event) { | 
| 539 session.config.Save(); | |
| 
174
 
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
 
Paper <mrpapersonic@gmail.com> 
parents: 
170 
diff
changeset
 | 
540 Anime::db.SaveDatabaseToDisk(); | 
| 2 | 541 event->accept(); | 
| 542 } | 
