Set up GUI.

This commit is contained in:
tastytea 2020-02-24 20:59:45 +01:00
parent 79ccf6ee3e
commit 0d6a39c8e5
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 69 additions and 1 deletions

View File

@ -37,7 +37,7 @@ if(WITH_CLANG-TIDY)
endif()
add_subdirectory(lib)
# add_subdirectory(gui)
add_subdirectory(gui)
# if(WITH_TESTS)
# add_subdirectory(tests)

5
gui/FediPotato.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>qml/mainwindow.qml</file>
</qresource>
</RCC>

12
gui/qml/mainwindow.qml Normal file
View File

@ -0,0 +1,12 @@
import QtQuick 2.10
import QtQuick.Controls 2.10
import QtQuick.Layouts 1.10
ApplicationWindow
{
id: win_main
title: "FediPotato"
visible: true
width: 400
height: 500
}

22
gui/src/CMakeLists.txt Normal file
View File

@ -0,0 +1,22 @@
include(GNUInstallDirs)
set(CMAKE_AUTOMOC ON)
find_package(Qt5 5.10 COMPONENTS Gui Qml Quick CONFIG REQUIRED)
add_executable(${PROJECT_NAME}GUI)
set_target_properties(${PROJECT_NAME}GUI PROPERTIES
OUTPUT_NAME "${PROJECT_NAME}"
CXX_CLANG_TIDY "") # The autogenerated code from Qt throws a lot of warnings.
qt5_add_resources(qml_ressources "../${PROJECT_NAME}.qrc")
file(GLOB_RECURSE sources_gui *.cpp)
target_sources(${PROJECT_NAME}GUI
PRIVATE "${sources_gui}" "${qml_ressources}")
target_link_libraries(${PROJECT_NAME}GUI
PRIVATE ${PROJECT_NAME} Qt5::Gui Qt5::Qml Qt5::Quick)
install(TARGETS ${PROJECT_NAME}GUI
DESTINATION "${CMAKE_INSTALL_BINDIR}")

29
gui/src/main.cpp Normal file
View File

@ -0,0 +1,29 @@
/* This file is part of FediPotato.
* Copyright © 2020 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/qml/mainwindow.qml")));
return QGuiApplication::exec();
}