Mercurial > minori
comparison src/gui/window.cc @ 190:2d5823df870f
dep/animia: finalize de-objc-ifying quartz
this also fixes up some... rather dumb mistakes in window.cc :)
HG Enter commit message. Lines beginning with 'HG:' are removed.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 06 Dec 2023 21:26:13 -0500 |
parents | f88eda79c60a |
children | 975a3f0965e2 |
comparison
equal
deleted
inserted
replaced
189:649786bae914 | 190:2d5823df870f |
---|---|
34 #include <QThreadPool> | 34 #include <QThreadPool> |
35 #include <QTimer> | 35 #include <QTimer> |
36 #include <QToolBar> | 36 #include <QToolBar> |
37 #include <QToolButton> | 37 #include <QToolButton> |
38 | 38 |
39 #include <iostream> | |
40 | |
39 #ifdef MACOSX | 41 #ifdef MACOSX |
40 # include "sys/osx/dark_theme.h" | 42 # include "sys/osx/dark_theme.h" |
41 #elif defined(WIN32) | 43 #elif defined(WIN32) |
42 # include "sys/win32/dark_theme.h" | 44 # include "sys/win32/dark_theme.h" |
43 #endif | 45 #endif |
62 | 64 |
63 MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { | 65 MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { |
64 setWindowIcon(QIcon(":/favicon.png")); | 66 setWindowIcon(QIcon(":/favicon.png")); |
65 | 67 |
66 main_widget.reset(new QWidget(this)); | 68 main_widget.reset(new QWidget(this)); |
67 /*QHBoxLayout* layout = */new QHBoxLayout(main_widget.get()); | 69 new QHBoxLayout(main_widget.get()); |
68 | 70 |
69 AddMainWidgets(); | 71 AddMainWidgets(); |
70 | 72 |
71 setCentralWidget(main_widget.get()); | 73 setCentralWidget(main_widget.get()); |
72 | 74 |
76 | 78 |
77 qRegisterMetaType<std::vector<std::string>>(); | 79 qRegisterMetaType<std::vector<std::string>>(); |
78 | 80 |
79 thread.reset(new PlayingThread(this)); | 81 thread.reset(new PlayingThread(this)); |
80 | 82 |
81 QTimer* timer = new QTimer; | 83 QTimer* timer = new QTimer(this); |
82 | 84 |
83 connect(timer, &QTimer::timeout, this, [this, page] { | 85 connect(timer, &QTimer::timeout, this, [this, page] { |
84 if (!thread.get() || thread->isRunning()) | 86 if (!thread.get() || thread->isRunning()) |
85 return; | 87 return; |
86 connect(thread.get(), &QThread::finished, thread.get(), &QThread::deleteLater); | 88 |
87 connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { | 89 connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { |
88 for (const auto& file : files) { | 90 for (const auto& file : files) { |
89 anitomy::Anitomy anitomy; | 91 anitomy::Anitomy anitomy; |
90 anitomy.Parse(Strings::ToWstring(file)); | 92 anitomy.Parse(Strings::ToWstring(file)); |
91 | 93 |
101 }); | 103 }); |
102 thread->start(); | 104 thread->start(); |
103 }); | 105 }); |
104 | 106 |
105 timer->start(5000); | 107 timer->start(5000); |
106 timer->moveToThread(thread.get()); | |
107 } | 108 } |
108 | 109 |
109 void MainWindow::AddMainWidgets() { | 110 void MainWindow::AddMainWidgets() { |
110 int page = static_cast<int>(Pages::ANIME_LIST); | 111 int page = static_cast<int>(Pages::ANIME_LIST); |
111 if (sidebar.get()) { | 112 if (sidebar.get()) { |