sepehrmoghiseh
2 years ago
commit
b1c50ab1ec
23 changed files with 466 additions and 0 deletions
@ -0,0 +1,76 @@ |
|||
# 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 |
|||
Makefile* |
|||
*.prl |
|||
*.app |
|||
moc_*.cpp |
|||
ui_*.h |
|||
qrc_*.cpp |
|||
Thumbs.db |
|||
*.res |
|||
*.rc |
|||
/.qmake.cache |
|||
/.qmake.stash |
|||
|
|||
# qtcreator generated files |
|||
*.pro.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 |
|||
|
|||
# qpmx |
|||
.qpmx-dev-cache |
|||
*.cppdummy |
@ -0,0 +1,7 @@ |
|||
TEMPLATE = subdirs |
|||
|
|||
SUBDIRS += \ |
|||
appLogReaderQuick \ |
|||
appLogReaderCore |
|||
|
|||
appLogReaderQuick.depends += appLogReaderCore |
@ -0,0 +1,35 @@ |
|||
#include "appLogReaderApp.h" |
|||
#include "MainViewModel.h" |
|||
|
|||
#include <QtCore/QCommandLineParser> |
|||
|
|||
appLogReaderApp::appLogReaderApp(QObject *parent) : |
|||
CoreApp(parent) |
|||
{ |
|||
QCoreApplication::setApplicationName(QStringLiteral("appLogReader")); |
|||
QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0")); |
|||
QCoreApplication::setOrganizationName(QStringLiteral("Example Organization")); |
|||
} |
|||
|
|||
void appLogReaderApp::performRegistrations() |
|||
{ |
|||
//if you are using a qt resource (e.g. "applogreadercore.qrc"), initialize it here
|
|||
Q_INIT_RESOURCE(applogreadercore); |
|||
} |
|||
|
|||
int appLogReaderApp::startApp(const QStringList &arguments) |
|||
{ |
|||
QCommandLineParser parser; |
|||
parser.addVersionOption(); |
|||
parser.addHelpOption(); |
|||
|
|||
//add more options
|
|||
|
|||
//shows help or version automatically
|
|||
if(!autoParse(parser, arguments)) |
|||
return EXIT_SUCCESS; |
|||
|
|||
//show a viewmodel to complete the startup
|
|||
show<MainViewModel>(); |
|||
return EXIT_SUCCESS; |
|||
} |
@ -0,0 +1,21 @@ |
|||
#ifndef APPLOGREADERAPP_H |
|||
#define APPLOGREADERAPP_H |
|||
|
|||
#include <QtMvvmCore/CoreApp> |
|||
|
|||
class appLogReaderApp : public QtMvvm::CoreApp |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit appLogReaderApp(QObject *parent = nullptr); |
|||
|
|||
protected: |
|||
void performRegistrations() override; |
|||
int startApp(const QStringList &arguments) override; |
|||
}; |
|||
|
|||
#undef coreApp |
|||
#define coreApp static_cast<appLogReaderApp*>(CoreApp::instance()) |
|||
|
|||
#endif // APPLOGREADERAPP_H
|
@ -0,0 +1,4 @@ |
|||
#ifndef LINKEDLIST_H |
|||
#define LINKEDLIST_H |
|||
|
|||
#endif // LINKEDLIST_H
|
@ -0,0 +1,27 @@ |
|||
#include "MainViewModel.h" |
|||
|
|||
#include <QtMvvmCore/SettingsViewModel> |
|||
|
|||
MainViewModel::MainViewModel(QObject *parent) : |
|||
ViewModel(parent), |
|||
_text(QStringLiteral("hello world")) |
|||
{} |
|||
|
|||
QString MainViewModel::text() const |
|||
{ |
|||
return _text; |
|||
} |
|||
|
|||
void MainViewModel::showSettings() |
|||
{ |
|||
show<QtMvvm::SettingsViewModel>(); |
|||
} |
|||
|
|||
void MainViewModel::setText(const QString &text) |
|||
{ |
|||
if (_text == text) |
|||
return; |
|||
|
|||
_text = text; |
|||
emit textChanged(_text); |
|||
} |
@ -0,0 +1,29 @@ |
|||
#ifndef MAINVIEWMODEL_H |
|||
#define MAINVIEWMODEL_H |
|||
|
|||
#include <QtMvvmCore/ViewModel> |
|||
|
|||
class MainViewModel : public QtMvvm::ViewModel |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) |
|||
|
|||
public: |
|||
Q_INVOKABLE explicit MainViewModel(QObject *parent = nullptr); |
|||
|
|||
QString text() const; |
|||
|
|||
public Q_SLOTS: |
|||
void showSettings(); |
|||
|
|||
void setText(const QString &text); |
|||
|
|||
Q_SIGNALS: |
|||
void textChanged(const QString &text); |
|||
|
|||
private: |
|||
QString _text; |
|||
}; |
|||
|
|||
#endif // MAINVIEWMODEL_H
|
@ -0,0 +1,4 @@ |
|||
#ifndef NODE_H |
|||
#define NODE_H |
|||
|
|||
#endif // NODE_H
|
@ -0,0 +1,6 @@ |
|||
#include "SortedLinkedList.h" |
|||
|
|||
SortedLinkedList::SortedLinkedList() |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,11 @@ |
|||
#ifndef SORTEDLINKEDLIST_H |
|||
#define SORTEDLINKEDLIST_H |
|||
|
|||
|
|||
class SortedLinkedList |
|||
{ |
|||
public: |
|||
SortedLinkedList(); |
|||
}; |
|||
|
|||
#endif // SORTEDLINKEDLIST_H
|
@ -0,0 +1,29 @@ |
|||
TEMPLATE = lib |
|||
|
|||
QT += mvvmcore |
|||
# Creating a static library is typically more efficient. You can still create a shared library if you want to |
|||
CONFIG += c++14 static |
|||
|
|||
TARGET = appLogReaderCore |
|||
|
|||
DEFINES += QT_DEPRECATED_WARNINGS |
|||
|
|||
HEADERS += \ |
|||
appLogReaderApp.h \ |
|||
MainViewModel.h |
|||
|
|||
SOURCES += \ |
|||
appLogReaderApp.cpp \ |
|||
MainViewModel.cpp |
|||
|
|||
RESOURCES += \ |
|||
applogreadercore.qrc |
|||
|
|||
TRANSLATIONS += applogreader_core_de.ts \ |
|||
applogreader_core_template.ts |
|||
|
|||
DISTFILES += $$TRANSLATIONS |
|||
QTMVVM_TS_SETTINGS = settings.xml |
|||
_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*) |
|||
# Uncomment the following line to automatically generated and update settings translations when building |
|||
#PRE_TARGETDEPS += qtmvvm-tsgen |
@ -0,0 +1,5 @@ |
|||
<RCC> |
|||
<qresource prefix="/etc"> |
|||
<file>settings.xml</file> |
|||
</qresource> |
|||
</RCC> |
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<SettingsConfig> |
|||
<Entry key="property" |
|||
type="bool" |
|||
title="&Check me" |
|||
tooltip="I am a checkbox!" |
|||
default="false" /> |
|||
</SettingsConfig> |
@ -0,0 +1,6 @@ |
|||
import QtQuick 2.10 |
|||
import de.skycoder42.QtMvvm.Quick 1.0 |
|||
|
|||
QtMvvmApp { |
|||
title: qsTr("appLogReader") |
|||
} |
@ -0,0 +1,70 @@ |
|||
import QtQuick 2.10 |
|||
import QtQuick.Controls 2.3 |
|||
import QtQuick.Layouts 1.3 |
|||
import de.skycoder42.QtMvvm.Core 1.0 |
|||
import de.skycoder42.QtMvvm.Quick 1.0 |
|||
import com.example.applogreader 1.0 |
|||
|
|||
Page { |
|||
id: mainView |
|||
property MainViewModel viewModel: null |
|||
|
|||
header: ContrastToolBar { |
|||
RowLayout { |
|||
anchors.fill: parent |
|||
spacing: 0 |
|||
|
|||
ToolBarLabel { |
|||
text: qsTr("MainViewModel") |
|||
Layout.fillWidth: true |
|||
} |
|||
|
|||
MenuButton { |
|||
MenuItem { |
|||
id: settings |
|||
text: qsTr("Settings") |
|||
onClicked: viewModel.showSettings() |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
PresenterProgress {} |
|||
|
|||
Pane { |
|||
anchors.fill: parent |
|||
|
|||
ColumnLayout { |
|||
anchors.fill: parent |
|||
|
|||
TextField { |
|||
id: textEdit |
|||
Layout.fillWidth: true |
|||
|
|||
MvvmBinding { |
|||
viewModel: mainView.viewModel |
|||
viewModelProperty: "text" |
|||
view: textEdit |
|||
viewProperty: "text" |
|||
} |
|||
} |
|||
|
|||
Label { |
|||
id: textLabel |
|||
Layout.fillWidth: true |
|||
|
|||
MvvmBinding { |
|||
viewModel: mainView.viewModel |
|||
viewModelProperty: "text" |
|||
view: textLabel |
|||
viewProperty: "text" |
|||
type: MvvmBinding.OneWayToView |
|||
} |
|||
} |
|||
|
|||
Item { |
|||
Layout.fillHeight: true |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
TEMPLATE = app |
|||
|
|||
QT += quick mvvmquick |
|||
CONFIG += c++14 |
|||
|
|||
TARGET = appLogReaderQuick |
|||
|
|||
DEFINES += QT_DEPRECATED_WARNINGS |
|||
|
|||
SOURCES += main.cpp |
|||
|
|||
RESOURCES += \ |
|||
applogreaderquick.qrc |
|||
|
|||
TRANSLATIONS += applogreader_quick_de.ts \ |
|||
applogreader_quick_template.ts |
|||
|
|||
# Link with core project |
|||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../appLogReaderCore/release/ -lappLogReaderCore |
|||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../appLogReaderCore/debug/ -lappLogReaderCore |
|||
else:unix: LIBS += -L$$OUT_PWD/../appLogReaderCore/ -lappLogReaderCore |
|||
|
|||
INCLUDEPATH += $$PWD/../appLogReaderCore |
|||
DEPENDPATH += $$PWD/../appLogReaderCore |
|||
|
|||
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/release/libappLogReaderCore.a |
|||
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/debug/libappLogReaderCore.a |
|||
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/release/appLogReaderCore.lib |
|||
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/debug/appLogReaderCore.lib |
|||
else:unix: PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/libappLogReaderCore.a |
|||
|
|||
# Additional import path used to resolve QML modules in Qt Creator's code model |
|||
QML_IMPORT_PATH = |
|||
|
|||
# Additional import path used to resolve QML modules just for Qt Quick Designer |
|||
QML_DESIGNER_IMPORT_PATH = |
@ -0,0 +1,8 @@ |
|||
<RCC> |
|||
<qresource prefix="/"> |
|||
<file>App.qml</file> |
|||
</qresource> |
|||
<qresource prefix="/qtmvvm/views"> |
|||
<file>MainView.qml</file> |
|||
</qresource> |
|||
</RCC> |
@ -0,0 +1,23 @@ |
|||
#include <QtGui/QGuiApplication> |
|||
#include <QtQml/QQmlApplicationEngine> |
|||
#include <appLogReaderApp.h> |
|||
#include <MainViewModel.h> |
|||
|
|||
QTMVVM_REGISTER_CORE_APP(appLogReaderApp) |
|||
|
|||
int main(int argc, char *argv[]) |
|||
{ |
|||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
|||
// If you want to support file dialogs on platforms other then android, use a QApplication instead (and add QT += widgets to the pro file)
|
|||
QGuiApplication app(argc, argv); |
|||
|
|||
QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963
|
|||
qmlRegisterUncreatableType<MainViewModel>("com.example.applogreader", 1, 0, "MainViewModel", "ViewModels cannot be created!"); |
|||
|
|||
QQmlApplicationEngine engine; |
|||
engine.load(QUrl(QStringLiteral("qrc:/App.qml"))); |
|||
if (engine.rootObjects().isEmpty()) |
|||
return -1; |
|||
|
|||
return app.exec(); |
|||
} |
@ -0,0 +1,6 @@ |
|||
#include "LinkedListTest.h" |
|||
|
|||
LinkedListTest::LinkedListTest() |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,11 @@ |
|||
#ifndef LINKEDLISTTEST_H |
|||
#define LINKEDLISTTEST_H |
|||
|
|||
|
|||
class LinkedListTest |
|||
{ |
|||
public: |
|||
LinkedListTest(); |
|||
}; |
|||
|
|||
#endif // LINKEDLISTTEST_H
|
@ -0,0 +1,9 @@ |
|||
QT += testlib |
|||
QT -= gui |
|||
|
|||
CONFIG += qt console warn_on depend_includepath testcase |
|||
CONFIG -= app_bundle |
|||
|
|||
TEMPLATE = app |
|||
|
|||
SOURCES += tst_test.cpp |
@ -0,0 +1,35 @@ |
|||
#include <QtTest> |
|||
|
|||
// add necessary includes here
|
|||
|
|||
class test : public QObject |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
test(); |
|||
~test(); |
|||
|
|||
private slots: |
|||
void test_case1(); |
|||
|
|||
}; |
|||
|
|||
test::test() |
|||
{ |
|||
|
|||
} |
|||
|
|||
test::~test() |
|||
{ |
|||
|
|||
} |
|||
|
|||
void test::test_case1() |
|||
{ |
|||
|
|||
} |
|||
|
|||
QTEST_APPLESS_MAIN(test) |
|||
|
|||
#include "tst_test.moc" |
Loading…
Reference in new issue