Skip to content

Commit

Permalink
Trying to use singleton in Gallery app on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Nov 29, 2023
1 parent 09aa8f2 commit 8d4c076
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 35 deletions.
17 changes: 17 additions & 0 deletions gallery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ qt_add_qml_module(
qml.qrc
)

add_subdirectory(qmlV2)
set_source_files_properties(qmlV2/StyleV2.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)

set(MM_QMLV2_SRCS)
foreach (src ${MM_QMLV2})
set(MM_QMLV2_SRCS ${MM_QMLV2_SRCS} qmlV2/${src})
set_source_files_properties(qmlV2/${src} PROPERTIES QT_RESOURCE_ALIAS ${src})
endforeach ()

qt_add_qml_module(
MerginMapsGallery
URI mmqmlv2
VERSION 1.0
QML_FILES ${MM_QMLV2_SRCS}
RESOURCE_PREFIX /com.merginmaps/imports NO_GENERATE_QMLTYPES
)

qt_add_resources(fonts.qrc)

set_target_properties(
Expand Down
10 changes: 5 additions & 5 deletions gallery/hotreload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ QString HotReload::syncScript() const
echo running hot reload sync directories ... \n\
while true; do \n\
rsync -ra ../../../../gallery/qml/ HotReload/qml/ \n\
rsync -ra ../../../../app/qmlV2/ HotReload/app/qmlV2/ \n\
rsync -ra ../../../../qmlV2/ HotReload/qmlV2/ \n\
sleep 1 \n\
done";
}
Expand All @@ -32,8 +32,8 @@ HotReload::HotReload( QQmlApplicationEngine &engine, QObject *parent ):
// create dirs for sync (near the app)
if ( !QDir( "HotReload/qml/" ).exists() )
QDir().mkpath( QGuiApplication::applicationDirPath() + "/HotReload/qml/" );
if ( !QDir( "HotReload/app/qmlV2/" ).exists() )
QDir().mkpath( QGuiApplication::applicationDirPath() + "/HotReload/app/qmlV2/" );
if ( !QDir( "HotReload/qmlV2/" ).exists() )
QDir().mkpath( QGuiApplication::applicationDirPath() + "/HotReload/qmlV2/" );

// create runnable sync script (near the app)
QString scriptFilename = QGuiApplication::applicationDirPath() + "/syncGallery.sh";
Expand Down Expand Up @@ -69,8 +69,8 @@ void HotReload::startHotReload()
{
_watcher = new QFileSystemWatcher( this );
_watcher->addPath( "HotReload/qml/Pages" );
_watcher->addPath( "HotReload/app/qmlV2" );
_watcher->addPath( "HotReload/app/qmlV2/component" );
_watcher->addPath( "HotReload/qmlV2" );
_watcher->addPath( "HotReload/qmlV2/component" );

// send signal for hot reloading
connect( _watcher, &QFileSystemWatcher::directoryChanged, this, [this]( const QString & path )
Expand Down
28 changes: 0 additions & 28 deletions gallery/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,12 @@
<file>qml/pages/InitialGalleryPage.qml</file>
<file>qml/pages/InputsPage.qml</file>
<file>qml/pages/ButtonsPage.qml</file>
<file>../app/qmlV2/component/MMInput.qml</file>
<file>../app/qmlV2/StyleV2.qml</file>
<file>../app/qmlV2/component/MMButton.qml</file>
<file>../app/qmlV2/component/MMLinkButton.qml</file>
<file>../app/qmlV2/component/MMLink.qml</file>
<file>../app/qmlV2/component/MMIcon.qml</file>
<file>../app/qmlV2/component/MMRoundButton.qml</file>
<file>../app/qmlV2/component/MMRoundLinkButton.qml</file>
<file>qml/pages/TextAreaPage.qml</file>
<file>../app/qmlV2/component/MMTextArea.qml</file>
<file>qml/pages/ComboBoxPage.qml</file>
<file>../app/qmlV2/component/MMComboBox.qml</file>
<file>../app/qmlV2/component/MMCheckBox.qml</file>
<file>../app/qmlV2/component/MMRadioButton.qml</file>
<file>../app/qmlV2/component/MMSwitch.qml</file>
<file>qml/pages/NotificationPage.qml</file>
<file>../app/qmlV2/component/MMNotification.qml</file>
<file>../app/qmlV2/component/MMNotificationView.qml</file>
<file>../app/qmlV2/component/MMDrawer.qml</file>
<file>qml/pages/DrawerPage.qml</file>
<file>qml/pages/ChecksPage.qml</file>
<file>../app/qmlV2/component/MMComponent_reachedDataLimit.qml</file>
<file>../app/qmlV2/component/MMProgressBar.qml</file>
<file>qml/pages/MapPage.qml</file>
<file>../app/qmlV2/component/MMMapButton.qml</file>
<file>../app/qmlV2/component/MMShadow.qml</file>
<file>../app/qmlV2/component/MMMapLabel.qml</file>
<file>../app/qmlV2/component/MMPasswordInput.qml</file>
<file>../app/qmlV2/component/MMButtonInput.qml</file>
<file>../app/qmlV2/component/MMToolbarButton.qml</file>
<file>../app/qmlV2/component/MMToolbar.qml</file>
<file>qml/pages/ToolbarPage.qml</file>
<file>../app/qmlV2/component/MMMenuDrawer.qml</file>
<file>../app/qmlV2/component/MMToolbarMenuButton.qml</file>
<file>../app/qmlV2/component/MMToolbarLongButton.qml</file>
</qresource>
</RCC>
4 changes: 2 additions & 2 deletions gallery/qml/pages/ToolbarPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import QtQuick
import QtQuick.Controls

import "../../app/qmlV2/component"
import "../../app/qmlV2/"
import "qmlV2/component"
import "qmlV2"

Page {
id: pane
Expand Down
37 changes: 37 additions & 0 deletions gallery/qmlV2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
set(MM_QMLV2
StyleV2.qml
component/MMButtonInput.qml
component/MMMenuDrawer.qml
component/MMRoundLinkButton.qml
component/MMNumberInput.qml
component/MMMapScaleLabel.qml
component/MMNotification.qml
component/MMTextArea.qml
component/MMCheckBox.qml
component/MMLabel.qml
component/MMRoundButton.qml
component/MMRadioButton.qml
component/MMDrawer.qml
component/MMMapButton.qml
component/MMLink.qml
component/MMToolbarLongButton.qml
component/MMToolbar.qml
component/map/MMPositionMarker.qml
component/MMSwitch.qml
component/MMLinkButton.qml
component/MMProgressBar.qml
component/MMMapLabel.qml
component/MMIcon.qml
component/MMToolbarMenuButton.qml
component/MMToolbarButton.qml
component/MMPasswordInput.qml
component/MMButton.qml
component/MMIconInputEditor.qml
component/MMComponent_reachedDataLimit.qml
component/MMNotificationView.qml
component/MMComboBox.qml
component/MMInput.qml
component/MMSliderInput.qml
component/MMShadow.qml
PARENT_SCOPE
)

0 comments on commit 8d4c076

Please sign in to comment.