Add Qt5 dependency and create a test window

This commit is contained in:
King_DuckZ 2021-03-26 21:22:47 +01:00
parent 49f2c3d4cb
commit ba37dfebf9
5 changed files with 59 additions and 3 deletions

3
config.h.in Normal file
View file

@ -0,0 +1,3 @@
#pragma once
#define APP_NAME "@APP_NAME@"

View file

@ -15,6 +15,8 @@
* along with remarkable_tool. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main_window.hpp"
#include <QApplication>
#include <iostream>
#include <simdjson.h>
#include <string_view>
@ -195,9 +197,13 @@ std::vector<const NotebookInfo*> make_dele_list (const Node& tree) {
}
} //unnamed namespace
int main() {
int main (int argc, char* argv[]) {
using std::string_view;
QApplication app(argc, argv);
duck::MainWindow win;
win.show();
auto notebooks = build_notebook_infos(BASE_PATH);
std::vector<Node> roots = to_tree(notebooks);
std::vector<const NotebookInfo*> dele_list;
@ -211,5 +217,5 @@ int main() {
std::cout << "/home/root/.local/share/remarkable/xochitl/" << f << '\n';
}
}
return 0;
return app.exec();
}

14
main_window.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "main_window.hpp"
#include "config.h"
#include <QLabel>
namespace duck {
MainWindow::MainWindow() {
setWindowTitle(APP_NAME);
QLabel* const main_label = new QLabel("Main label thing");
setCentralWidget(main_label);
main_label->setAlignment(Qt::AlignCenter);
}
MainWindow::~MainWindow() noexcept = default;
} //namespace duck

12
main_window.hpp Normal file
View file

@ -0,0 +1,12 @@
#pragma once
#include <QMainWindow>
namespace duck {
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow();
virtual ~MainWindow() noexcept;
};
} //namespace duck

View file

@ -8,12 +8,33 @@ project('remarkable_tool', 'cpp',
],
)
conf = configuration_data()
conf.set('APP_NAME', meson.project_name())
project_config_file = configure_file(
input: 'config.h.in',
output: 'config.h',
configuration: conf,
)
qt5 = import('qt5')
qt5_dep = dependency('qt5', modules: ['Core', 'Gui', 'Widgets'])
moc_files = qt5.preprocess(
moc_headers: 'main_window.hpp',
dependencies: qt5_dep
)
simdjson_dep = dependency('simdjson', version: '>=0.5.0',
fallback: ['simdjson', 'simdjson_dep'],
)
executable(meson.project_name(),
'main.cpp',
dependencies: simdjson_dep,
'main_window.cpp',
moc_files,
dependencies: [
simdjson_dep,
qt5_dep,
],
install: true,
)