parent
608fdbdac8
commit
3528b2ff44
|
@ -1 +1,12 @@
|
|||
.DS_Store
|
||||
moc_*
|
||||
*.pro.user
|
||||
qrc_*
|
||||
*.o
|
||||
build-*
|
||||
*.qmlc
|
||||
bin
|
||||
*.app
|
||||
*.autosave
|
||||
Makefile
|
||||
.qmake.stash
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
import StatusQ.Core 0.1
|
||||
|
||||
GridLayout {
|
||||
columns: 6
|
||||
columnSpacing: 5
|
||||
rowSpacing: 5
|
||||
property color iconColor
|
||||
|
||||
Repeater {
|
||||
model: ["activity", "add-circle", "add-contact", "add",
|
||||
"address", "admin", "airdrop", "animals-and-nature",
|
||||
"browser", "arbitrator", "camera", "chat", "channel",
|
||||
"chatbot", "checkmark", "clear", "code", "communities"]
|
||||
|
||||
delegate: StatusIcon {
|
||||
icon: modelData
|
||||
color: iconColor
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#include "handler.h"
|
||||
|
||||
Handler::Handler(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef HANDLER_H
|
||||
#define HANDLER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Handler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Handler(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void restartQml();
|
||||
};
|
||||
|
||||
#endif // HANDLER_H
|
|
@ -0,0 +1,17 @@
|
|||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QDebug>
|
||||
|
||||
#include "sandboxapp.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
SandboxApp app(argc, argv);
|
||||
app.startEngine();
|
||||
|
||||
return app.exec();
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Window 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
Window {
|
||||
id: rootWindow
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true
|
||||
title: qsTr("Status App Sandbox")
|
||||
|
||||
ButtonGroup {
|
||||
id: topicsGroup
|
||||
buttons: tabs.children
|
||||
}
|
||||
|
||||
Flow {
|
||||
id: tabs
|
||||
width: parent.width
|
||||
Button {
|
||||
text: "Reload QML"
|
||||
onClicked: app.restartQml()
|
||||
}
|
||||
Button {
|
||||
id: iconsTab
|
||||
checkable: true
|
||||
text: "Icons"
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
width: parent.width
|
||||
anchors.top: tabs.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
contentHeight: rootWindow.height * rootWindow.factor
|
||||
contentWidth: rootWindow.width * rootWindow.factor
|
||||
clip: true
|
||||
SplitView {
|
||||
width: parent.width
|
||||
height: rootWindow.height
|
||||
handle: Item {}
|
||||
|
||||
scale: rootWindow.factor
|
||||
|
||||
Rectangle {
|
||||
id: lightThemeBg
|
||||
|
||||
SplitView.minimumWidth: rootWindow.width / 2
|
||||
height: parent.height
|
||||
color: lightTheme.baseColor5
|
||||
clip: true
|
||||
|
||||
Loader {
|
||||
active: true
|
||||
anchors.centerIn: parent
|
||||
property var currentTheme: StatusLightTheme { id: lightTheme }
|
||||
|
||||
sourceComponent: {
|
||||
switch(topicsGroup.checkedButton) {
|
||||
case iconsTab:
|
||||
return iconsComponent;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: darkThemeBg
|
||||
|
||||
SplitView.fillWidth: true
|
||||
SplitView.minimumWidth: rootWindow.width / 2
|
||||
height: parent.height
|
||||
color: darkTheme.baseColor5
|
||||
clip: true
|
||||
|
||||
Loader {
|
||||
active: true
|
||||
anchors.centerIn: parent
|
||||
property var currentTheme: StatusDarkTheme { id: darkTheme }
|
||||
|
||||
sourceComponent: {
|
||||
switch(topicsGroup.checkedButton) {
|
||||
case iconsTab:
|
||||
return iconsComponent;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property real maxFactor: 2.0
|
||||
readonly property real minFactor: 0.5
|
||||
|
||||
property real factor: 1.0
|
||||
Action {
|
||||
shortcut: "CTRL+="
|
||||
onTriggered: {
|
||||
if (rootWindow.factor < 2.0)
|
||||
rootWindow.factor += 0.2
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
shortcut: "CTRL+-"
|
||||
onTriggered: {
|
||||
if (rootWindow.factor > 0.5)
|
||||
rootWindow.factor -= 0.2
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
shortcut: "CTRL+0"
|
||||
onTriggered: {
|
||||
rootWindow.factor = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: iconsComponent
|
||||
Icons {
|
||||
anchors.centerIn: parent
|
||||
iconColor: parent? parent.currentTheme.primaryColor1 : "#ffffff"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>Icons.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -0,0 +1,28 @@
|
|||
QT += quick
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
# You can make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
handler.cpp \
|
||||
main.cpp \
|
||||
sandboxapp.cpp
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
DESTDIR = $$PWD/bin
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
OTHER_FILES += $$files($$PWD/../src/*, true)
|
||||
|
||||
HEADERS += \
|
||||
handler.h \
|
||||
sandboxapp.h
|
|
@ -0,0 +1,36 @@
|
|||
#include "sandboxapp.h"
|
||||
|
||||
#include <QQmlContext>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
SandboxApp::SandboxApp(int &argc, char **argv)
|
||||
: QGuiApplication(argc, argv),
|
||||
m_handler(new Handler(this))
|
||||
{
|
||||
connect(m_handler, &Handler::restartQml, this, &SandboxApp::restartEngine, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void SandboxApp::startEngine()
|
||||
{
|
||||
const QUrl url(applicationDirPath() + "/../main.qml");
|
||||
|
||||
m_engine.rootContext()->setContextProperty("app", m_handler);
|
||||
|
||||
m_engine.addImportPath(applicationDirPath() + "/../../src");
|
||||
qDebug() << m_engine.importPathList();
|
||||
QObject::connect(&m_engine, &QQmlApplicationEngine::objectCreated,
|
||||
this, [url](QObject *obj, const QUrl &objUrl) {
|
||||
if (!obj && url == objUrl)
|
||||
QCoreApplication::exit(-1);
|
||||
}, Qt::QueuedConnection);
|
||||
m_engine.load(url);
|
||||
}
|
||||
|
||||
void SandboxApp::restartEngine()
|
||||
{
|
||||
const QUrl url(applicationDirPath() + "/../main.qml");
|
||||
m_engine.rootObjects().at(0)->deleteLater();
|
||||
m_engine.clearComponentCache();
|
||||
m_engine.load(url);
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef SANDBOXAPP_H
|
||||
#define SANDBOXAPP_H
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
#include "handler.h"
|
||||
|
||||
class SandboxApp : public QGuiApplication
|
||||
{
|
||||
public:
|
||||
SandboxApp(int &argc, char **argv);
|
||||
|
||||
void startEngine();
|
||||
|
||||
public slots:
|
||||
void restartEngine();
|
||||
|
||||
private:
|
||||
QQmlApplicationEngine m_engine;
|
||||
Handler *m_handler;
|
||||
};
|
||||
|
||||
#endif // SANDBOXAPP_H
|
|
@ -1,3 +1,5 @@
|
|||
module StatusQ.Core.Theme
|
||||
|
||||
singleton StatusColors 0.1 StatusColors.qml
|
||||
ThemePalette 0.1 ThemePalette.qml
|
||||
StatusLightTheme 0.1 StatusLightTheme.qml
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
module StatusQ.Core
|
||||
|
||||
StatusIcon 0.1 StatusIcon.qml
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module StatusQ
|
||||
|
Loading…
Reference in New Issue