mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
interface: add Qt interface
This commit is contained in:
parent
981bb36a13
commit
a2317e71aa
@ -1,4 +1,4 @@
|
||||
project('tuxclocker', 'c')
|
||||
project('tuxclocker', 'c', 'cpp')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
|
@ -18,6 +18,9 @@ tc_module_t *tc_module_find(enum tc_module_category category, const char *name)
|
||||
case TC_CATEGORY_ASSIGNABLE:
|
||||
snprintf(abs_env_path, 128, "%s/%s/%s", env_module_path, "assignable", name);
|
||||
break;
|
||||
case TC_CATEGORY_INTERFACE:
|
||||
snprintf(abs_env_path, 128, "%s/%s/%s", env_module_path, "interface", name);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -7,10 +7,11 @@
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Load an interface here
|
||||
tc_module_t *mod = tc_module_find(TC_CATEGORY_ASSIGNABLE, "libnvidia.so");
|
||||
tc_module_t *mod = tc_module_find(TC_CATEGORY_INTERFACE, "/qt/libqt.so");
|
||||
|
||||
if (mod != NULL) {
|
||||
printf("successful load for %s\n", mod->name);
|
||||
mod->init_callback(argc, argv);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
1
src/modules/interface/meson.build
Normal file
1
src/modules/interface/meson.build
Normal file
@ -0,0 +1 @@
|
||||
subdir('qt')
|
7
src/modules/interface/qt/MainWindow.cpp
Normal file
7
src/modules/interface/qt/MainWindow.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "MainWindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
}
|
15
src/modules/interface/qt/MainWindow.h
Normal file
15
src/modules/interface/qt/MainWindow.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
};
|
37
src/modules/interface/qt/main.cpp
Normal file
37
src/modules/interface/qt/main.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include <tc_interface.h>
|
||||
#include <tc_module.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char **argv);
|
||||
|
||||
// Don't scramble the interaction point symbols
|
||||
extern "C" {
|
||||
|
||||
// Module Information
|
||||
static tc_module_t mod_info = {
|
||||
.category = TC_CATEGORY_INTERFACE,
|
||||
.name = "qt",
|
||||
.description = "Qt Interface",
|
||||
.init_callback = (int8_t (*)()) &main,
|
||||
.close_callback = NULL
|
||||
};
|
||||
|
||||
tc_module_t *TC_MODULE_INFO_FUNCTION();
|
||||
|
||||
tc_module_t *TC_MODULE_INFO_FUNCTION() {
|
||||
return &mod_info;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
15
src/modules/interface/qt/meson.build
Normal file
15
src/modules/interface/qt/meson.build
Normal file
@ -0,0 +1,15 @@
|
||||
qt5 = import('qt5')
|
||||
qt5_dep = dependency('qt5',
|
||||
modules : ['Widgets'])
|
||||
|
||||
moc_files = qt5.preprocess(moc_headers : [ 'MainWindow.h'],
|
||||
dependencies : qt5_dep)
|
||||
|
||||
sources = ['main.cpp',
|
||||
'MainWindow.cpp']
|
||||
|
||||
shared_library('qt',
|
||||
sources,
|
||||
moc_files,
|
||||
include_directories : incdir,
|
||||
dependencies : qt5_dep)
|
@ -1 +1,2 @@
|
||||
subdir('assignable')
|
||||
subdir('interface')
|
||||
|
Loading…
Reference in New Issue
Block a user