Skip to content

Commit

Permalink
refactor++...
Browse files Browse the repository at this point in the history
  • Loading branch information
lduboeuf committed Nov 7, 2021
1 parent 4e7cdf0 commit 26321dc
Show file tree
Hide file tree
Showing 20 changed files with 103 additions and 137 deletions.
31 changes: 22 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ find_package(Qt5Core REQUIRED)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5QuickControls2 REQUIRED)
find_package(ECM NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_FIND_MODULE_DIR})
find_package(KF5 REQUIRED COMPONENTS Archive)

execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
Expand Down Expand Up @@ -46,18 +49,26 @@ install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
install(FILES ${PROJECT_NAME}-contenthub.json DESTINATION ${DATA_DIR})
install(FILES assets/logo.svg DESTINATION assets)

qt5_add_resources(QT_RESOURCES qml/qml.qrc)
qt5_add_resources(QT_RESOURCES assets/assets.qrc)
#qt5_add_resources(QT_RESOURCES qml/qml.qrc)
#qt5_add_resources(QT_RESOURCES assets/assets.qrc)

add_executable(${PROJECT_NAME} main.cpp ${QT_RESOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE -s)
#set(
# SRC
# main.cpp
# archiveitem.cpp
# archivemanager.cpp
# archivereader.cpp
#)

#add_executable(${PROJECT_NAME} ${SRC} ${QT_RESOURCES})
#set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE -s)
#target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${QUAZIP_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Qml Qt5::Quick Qt5::QuickControls2
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
#target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Qml Qt5::Quick Qt5::QuickControls2 KF5::Archive
# )
#install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})

# Translations
file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js)
file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po src/qml/*.qml src/qml/*.js)
list(APPEND I18N_SRC_FILES ${DESKTOP_FILE_NAME}.in.h)

find_program(INTLTOOL_MERGE intltool-merge)
Expand All @@ -76,9 +87,11 @@ add_custom_target(${DESKTOP_FILE_NAME} ALL
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
#install(FILES assets/logo.svg DESTINATION /assets)

add_subdirectory(po)
add_subdirectory(plugins)
add_subdirectory(src)
#add_subdirectory(plugins)

# Make source files visible in qtcreator
file(GLOB_RECURSE PROJECT_SRC_FILES
Expand Down
33 changes: 0 additions & 33 deletions plugins/ArchiveManager/CMakeLists.txt

This file was deleted.

27 changes: 0 additions & 27 deletions plugins/ArchiveManager/plugin.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions plugins/ArchiveManager/plugin.h

This file was deleted.

2 changes: 0 additions & 2 deletions plugins/ArchiveManager/qmldir

This file was deleted.

1 change: 0 additions & 1 deletion plugins/CMakeLists.txt

This file was deleted.

64 changes: 32 additions & 32 deletions po/utzip.lduboeuf.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: utzip.lduboeuf\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-05 16:43+0000\n"
"POT-Creation-Date: 2021-11-07 21:52+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -17,127 +17,127 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../qml/About.qml:11
#: ../src/qml/About.qml:11
msgid "About"
msgstr ""

#: ../qml/About.qml:30
#: ../src/qml/About.qml:30
msgid "Archive Reader - Writer"
msgstr ""

#: ../qml/About.qml:35
#: ../src/qml/About.qml:35
msgid "Should support archive files like:"
msgstr ""

#: ../qml/About.qml:45
#: ../src/qml/About.qml:45
msgid "Source code:"
msgstr ""

#: ../qml/ArchiveExplorer.qml:78
#: ../src/qml/ArchiveExplorer.qml:78
msgid "up"
msgstr ""

#: ../qml/ArchiveExplorer.qml:84 ../qml/ArchiveWriter.qml:70
#: ../src/qml/ArchiveExplorer.qml:84 ../src/qml/ArchiveWriter.qml:70
msgid "home"
msgstr ""

#: ../qml/ArchiveExplorer.qml:122
#: ../src/qml/ArchiveExplorer.qml:122
msgid "select all"
msgstr ""

#: ../qml/ArchiveExplorer.qml:140 ../qml/ArchiveWriter.qml:229
#: ../src/qml/ArchiveExplorer.qml:140 ../src/qml/ArchiveWriter.qml:229
msgid "Oups, something went wrong"
msgstr ""

#: ../qml/ArchiveWriter.qml:33
#: ../src/qml/ArchiveWriter.qml:33
msgid "new Archive"
msgstr ""

#: ../qml/ArchiveWriter.qml:115
#: ../src/qml/ArchiveWriter.qml:115
msgid "add files"
msgstr ""

#: ../qml/ArchiveWriter.qml:121
#: ../src/qml/ArchiveWriter.qml:121
msgid "new folder"
msgstr ""

#: ../qml/ArchiveWriter.qml:169
#: ../src/qml/ArchiveWriter.qml:169
msgid "delete"
msgstr ""

#: ../qml/ArchiveWriter.qml:258
#: ../src/qml/ArchiveWriter.qml:258
msgid "Import files"
msgstr ""

#: ../qml/ArchiveWriter.qml:269
#: ../src/qml/ArchiveWriter.qml:269
msgid "Export archive"
msgstr ""

#: ../qml/ArchiveWriter.qml:276
#: ../src/qml/ArchiveWriter.qml:276
msgid "my archive name"
msgstr ""

#: ../qml/ArchiveWriter.qml:286
#: ../src/qml/ArchiveWriter.qml:286
msgid "format"
msgstr ""

#: ../qml/ArchiveWriter.qml:293 ../qml/ArchiveWriter.qml:340
#: ../src/qml/ArchiveWriter.qml:293 ../src/qml/ArchiveWriter.qml:340
msgid "cancel"
msgstr ""

#: ../qml/ArchiveWriter.qml:300
#: ../src/qml/ArchiveWriter.qml:300
msgid "save"
msgstr ""

#: ../qml/ArchiveWriter.qml:318
#: ../src/qml/ArchiveWriter.qml:318
msgid "Add folder"
msgstr ""

#: ../qml/ArchiveWriter.qml:324
#: ../src/qml/ArchiveWriter.qml:324
msgid "Folder name"
msgstr ""

#: ../qml/ArchiveWriter.qml:331
#: ../src/qml/ArchiveWriter.qml:331
msgid "new folder..."
msgstr ""

#: ../qml/ArchiveWriter.qml:347
#: ../src/qml/ArchiveWriter.qml:347
msgid "ok"
msgstr ""

#: ../qml/Main.qml:97
#: ../src/qml/Main.qml:97
msgid "info"
msgstr ""

#: ../qml/Main.qml:111
#: ../src/qml/Main.qml:111
msgid "Open archive"
msgstr ""

#: ../qml/Main.qml:127
#: ../src/qml/Main.qml:127
msgid "Create archive"
msgstr ""

#: ../qml/Main.qml:145
#: ../src/qml/Main.qml:145
msgid "Choose from"
msgstr ""

#: ../qml/Main.qml:171
#: ../src/qml/Main.qml:171
msgid "Export to"
msgstr ""

#: ../qml/Main.qml:215
#: ../src/qml/Main.qml:215
msgid "Unsupported archive format"
msgstr ""

#: ../qml/Main.qml:227
#: ../src/qml/Main.qml:227
msgid "Would you like to create one with that file(s) ?"
msgstr ""

#: ../qml/Main.qml:233
#: ../src/qml/Main.qml:233
msgid "no"
msgstr ""

#: ../qml/Main.qml:239
#: ../src/qml/Main.qml:239
msgid "yes"
msgstr ""

Expand Down
38 changes: 38 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
set(UTZIP_APP utzip)

set(utzip_HDRS
archiveitem.h
archivemanager.h
archivereader.h
)

set(utzip_SRCS
main.cpp
archiveitem.cpp
archivemanager.cpp
archivereader.cpp
)

#qt5_use_modules(${UTZIP_APP} Qml Quick)
qt5_add_resources(QT_RESOURCES qml/qml.qrc)
qt5_add_resources(QT_RESOURCES ../assets/assets.qrc)

add_executable(${UTZIP_APP}
${utzip_SRCS}
${QT_RESOURCES}
)
target_link_libraries(${UTZIP_APP} Qt5::Qml Qt5::Quick Qt5::QuickControls2 KF5::Archive)
install(TARGETS ${UTZIP_APP} RUNTIME DESTINATION /)



include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)

#install(TARGETS ${UTZIP_APP}
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
# )


File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void ArchiveManager::setNewArchiveDir(const QUrl &path)
if (mNewArchiveDir != path) {
mNewArchiveDir = path;
mCurrentDir = path;
qDebug() << "tempDir" << path;
qDebug() << "mNewArchiveDir" << path;
Q_EMIT newArchiveDirChanged();
Q_EMIT currentDirChanged();
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions main.cpp → src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,23 @@
#include <QStandardPaths>
#include <QDir>

#include "archivereader.h"
#include "archivemanager.h"

int main(int argc, char *argv[])
{
QGuiApplication *app = new QGuiApplication(argc, (char**)argv);
app->setApplicationName("utzip.lduboeuf");

qmlRegisterType<ArchiveReader>("ArchiveManager",1, 0, "ArchiveReader");
qmlRegisterSingletonType<ArchiveManager>("ArchiveManager", 1, 0, "ArchiveManager", [](QQmlEngine*, QJSEngine*) -> QObject* { return new ArchiveManager; });


QQuickView *view = new QQuickView();
view->setSource(QUrl("qrc:/Main.qml"));
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->show();


return app->exec();
}
Loading

0 comments on commit 26321dc

Please sign in to comment.