feat: add gallery app for viewing/testing
This commit is contained in:
@@ -0,0 +1,84 @@
|
|||||||
|
# This file is used to ignore files which are generated
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
*~
|
||||||
|
*.autosave
|
||||||
|
*.a
|
||||||
|
*.core
|
||||||
|
*.moc
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*_pch.h.cpp
|
||||||
|
*_resource.rc
|
||||||
|
*.qm
|
||||||
|
.#*
|
||||||
|
*.*#
|
||||||
|
core
|
||||||
|
!core/
|
||||||
|
tags
|
||||||
|
.DS_Store
|
||||||
|
.directory
|
||||||
|
*.debug
|
||||||
|
*.prl
|
||||||
|
*.app
|
||||||
|
moc_*.cpp
|
||||||
|
ui_*.h
|
||||||
|
qrc_*.cpp
|
||||||
|
Thumbs.db
|
||||||
|
*.res
|
||||||
|
*.rc
|
||||||
|
/.qmake.cache
|
||||||
|
/.qmake.stash
|
||||||
|
|
||||||
|
# qtcreator generated files
|
||||||
|
*.pro.user*
|
||||||
|
*.qbs.user*
|
||||||
|
CMakeLists.txt.user*
|
||||||
|
|
||||||
|
# xemacs temporary files
|
||||||
|
*.flc
|
||||||
|
|
||||||
|
# Vim temporary files
|
||||||
|
.*.swp
|
||||||
|
|
||||||
|
# Visual Studio generated files
|
||||||
|
*.ib_pdb_index
|
||||||
|
*.idb
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.vcproj
|
||||||
|
*vcproj.*.*.user
|
||||||
|
*.ncb
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.vcxproj
|
||||||
|
*vcxproj.*
|
||||||
|
|
||||||
|
# MinGW generated files
|
||||||
|
*.Debug
|
||||||
|
*.Release
|
||||||
|
|
||||||
|
# Python byte code
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
# --------
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
# Directories with generated files
|
||||||
|
.moc/
|
||||||
|
.obj/
|
||||||
|
.pch/
|
||||||
|
.rcc/
|
||||||
|
.uic/
|
||||||
|
build*/
|
||||||
|
|
||||||
|
.cache/
|
||||||
|
.qmlls.ini
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.21.1)
|
||||||
|
|
||||||
|
project(gallery VERSION 1.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
# generate compile_commands.json
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
add_subdirectory(../ ${CMAKE_BINARY_DIR}/designsystem)
|
||||||
|
|
||||||
|
find_package(Qt6 6.8 REQUIRED COMPONENTS
|
||||||
|
Quick
|
||||||
|
Core
|
||||||
|
QuickControls2
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_standard_project_setup(REQUIRES 6.8)
|
||||||
|
|
||||||
|
set(SOURCES main.cpp)
|
||||||
|
qt_add_executable(Gallery MACOSX_BUNDLE ${SOURCES})
|
||||||
|
|
||||||
|
qt_add_qml_module(Gallery
|
||||||
|
URI Gallery
|
||||||
|
VERSION 1.0
|
||||||
|
RESOURCE_PREFIX /live.flowy/imports
|
||||||
|
QML_FILES
|
||||||
|
Main.qml
|
||||||
|
RESOURCES
|
||||||
|
)
|
||||||
|
|
||||||
|
# including every subdirectory because : https://bugreports.qt.io/browse/QTBUG-101146
|
||||||
|
target_include_directories(Gallery PRIVATE src)
|
||||||
|
|
||||||
|
target_link_libraries(Gallery
|
||||||
|
PRIVATE
|
||||||
|
Qt6::Quick
|
||||||
|
Qt6::Core
|
||||||
|
designsystemplugin
|
||||||
|
)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(TARGETS Gallery
|
||||||
|
BUNDLE DESTINATION .
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Qt.labs.platform
|
||||||
|
import Gallery
|
||||||
|
import DesignSystem
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
id: window
|
||||||
|
width: 640
|
||||||
|
height: 480
|
||||||
|
visible: true
|
||||||
|
title: qsTr("flowy - gallery")
|
||||||
|
|
||||||
|
palette {
|
||||||
|
accent: Theme.accent
|
||||||
|
dark: Theme.foreground
|
||||||
|
window: Theme.background
|
||||||
|
windowText: Theme.foreground
|
||||||
|
base: Theme.muted
|
||||||
|
brightText: Theme.muted
|
||||||
|
text: Theme.foreground
|
||||||
|
button: Theme.accent
|
||||||
|
buttonText: "#FFFFFF"
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.margins: 10
|
||||||
|
|
||||||
|
AppPrimaryButton {
|
||||||
|
text: "Toggle theme"
|
||||||
|
onClicked: {
|
||||||
|
Theme.toggleTheme()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AppCard {
|
||||||
|
Column {
|
||||||
|
spacing: 10
|
||||||
|
AppText {
|
||||||
|
text: "This is a card"
|
||||||
|
}
|
||||||
|
AppCaption {
|
||||||
|
text: "Caption"
|
||||||
|
}
|
||||||
|
AppHeadline {
|
||||||
|
text: "Headline"
|
||||||
|
}
|
||||||
|
AppSubHeadline {
|
||||||
|
text: "SubHeadline"
|
||||||
|
}
|
||||||
|
AppLabel {
|
||||||
|
text: "Label"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
|
||||||
|
#include <QtQml/QQmlExtensionPlugin>
|
||||||
|
Q_IMPORT_QML_PLUGIN(DesignSystemPlugin)
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
QObject::connect(
|
||||||
|
&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); },
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
// https://doc.qt.io/qt-6/qtqml-writing-a-module.html#eliminating-run-time-file-system-access
|
||||||
|
engine.addImportPath(":/live.flowy/imports");
|
||||||
|
|
||||||
|
engine.loadFromModule("Gallery", "Main");
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
BUILD_DIR=build
|
||||||
|
|
||||||
|
#NOTE: the PROJECT_VERSION is a dummy placeholder just for local builds
|
||||||
|
if [ ! -d "$BUILD_DIR" ]; then
|
||||||
|
cmake -B$BUILD_DIR -S. -GNinja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DCMAKE_CXX_FLAGS="-Wall -Wextra" \
|
||||||
|
-DCMAKE_PREFIX_PATH="$HOME/Qt/6.8.3/macos" \
|
||||||
|
-DCMAKE_COLOR_DIAGNOSTICS=ON \
|
||||||
|
-DCMAKE_CXX_FLAGS_INIT="-DQT_QML_DEBUG" \
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES="arm64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmake --build $BUILD_DIR --target all
|
||||||
|
|
||||||
|
$BUILD_DIR/Gallery.app/Contents/MacOS/Gallery
|
||||||
Reference in New Issue
Block a user