Skip to content

Commit

Permalink
Call into libtheterminal
Browse files Browse the repository at this point in the history
  • Loading branch information
vicr123 committed Apr 13, 2024
1 parent 70328d5 commit aeb3d19
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cntp_defaults_file(theterminal
DEFAULTS_FILE theterminal.conf)

target_link_libraries(theterminal PUBLIC Qt::Widgets Qt::Quick Qt::QuickControls2 libcontemporary libtheterminal)
target_include_directories(theterminal PUBLIC ../libtheterminal/common/)
target_include_directories(theterminal PUBLIC ../libtheterminal/common/ ../libtheterminal)

install(TARGETS theterminal
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
9 changes: 6 additions & 3 deletions application/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QUrl>
#include <abstractpty.h>
#include <tapplication.h>
#include <theterminal-init.h>
#include <tlogger.h>
#include <tsettings.h>
#include <tstylemanager.h>
Expand All @@ -14,6 +15,8 @@ int main(int argc, char* argv[]) {
a.setApplicationShareDir("theterminal");
a.installTranslators();

theTerminal::init();

a.setApplicationVersion("1.0");
a.setGenericName(QApplication::translate("main", "Terminal"));
a.setApplicationLicense(tApplication::Gpl3OrLater);
Expand All @@ -28,7 +31,7 @@ int main(int argc, char* argv[]) {
#endif

tSettings settings;
QObject::connect(&settings, &tSettings::settingChanged, [ = ](QString key, QVariant value) {
QObject::connect(&settings, &tSettings::settingChanged, [=](QString key, QVariant value) {
if (key == "theme/mode") {
tStyleManager::setOverrideStyleForApplication(value.toString() == "light" ? tStyleManager::ContemporaryLight : tStyleManager::ContemporaryDark);
}
Expand All @@ -41,11 +44,11 @@ int main(int argc, char* argv[]) {
QQmlApplicationEngine engine;
const QUrl url(u"qrc:/qt/qml/com/vicr123/theterminal/Main.qml"_qs);
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreationFailed, &a, [](QUrl url) {
&engine, &QQmlApplicationEngine::objectCreationFailed, &a, [](QUrl url) {
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
QObject::connect(
&engine, &QQmlApplicationEngine::warnings, &a, [](const QList<QQmlError>& warnings) {
&engine, &QQmlApplicationEngine::warnings, &a, [](const QList<QQmlError>& warnings) {

}, Qt::QueuedConnection);
engine.load(url);
Expand Down
2 changes: 1 addition & 1 deletion application/translations/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<context>
<name>main</name>
<message>
<location filename="../main.cpp" line="18"/>
<location filename="../main.cpp" line="21"/>
<source>Terminal</source>
<translation type="unfinished"></translation>
</message>
Expand Down
2 changes: 2 additions & 0 deletions libtheterminal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ find_package(libcontemporary REQUIRED)

set(SOURCES
qmlinit.cpp
theterminal-init.cpp
)

set(HEADERS
libtheterminal_global.h
theterminal-init.h
)

set(PRIVATE_HEADERS
Expand Down
9 changes: 9 additions & 0 deletions libtheterminal/theterminal-init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "theterminal-init.h"
#include <QQmlExtensionPlugin>

Q_IMPORT_QML_PLUGIN(com_vicr123_theterminal_libtheterminalPlugin)

void theTerminal::init() {
const volatile auto i = 0;
Q_UNUSED(i)
}
8 changes: 8 additions & 0 deletions libtheterminal/theterminal-init.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef THETERMINALINIT_H
#define THETERMINALINIT_H

namespace theTerminal {
void init();
}

#endif // THETERMINALINIT_H

0 comments on commit aeb3d19

Please sign in to comment.