From a268b0d310d09cee5f4f98c0ccad9ccaea0d9e82 Mon Sep 17 00:00:00 2001
From: Akira Ohgaki <akiraohgaki@gmail.com>
Date: Thu, 23 Feb 2017 10:42:04 +0900
Subject: [PATCH] Restructure qmake project

---
 app/app.pri                                   | 21 ++++++++++++++
 {src/app => app}/configs/application.json     |  0
 {src/app => app}/configs/configs.qrc          |  0
 {src/app => app}/configs/install_types.json   |  0
 .../configs/install_types_alias.json          |  0
 {src/app => app}/qml/main.qml                 |  0
 {src/app => app}/qml/qml.qrc                  |  0
 {src/app => app}/qml/scripts/Utility.js       |  0
 .../src}/handlers/confighandler.cpp           |  0
 {src/app => app/src}/handlers/confighandler.h |  0
 .../src}/handlers/ocsurlhandler.cpp           |  0
 {src/app => app/src}/handlers/ocsurlhandler.h |  0
 {src/app => app/src}/main.cpp                 |  0
 deployment.pri                                |  2 +-
 desktop/desktop.pri                           |  3 ++
 {src/desktop => desktop}/desktop.qrc          |  0
 {src/desktop => desktop}/ocs-url.desktop      |  0
 {src/desktop => desktop}/ocs-url.svg          |  0
 i18n/i18n.pri                                 |  1 +
 {src/i18n => i18n}/i18n.pro                   |  2 +-
 {src/i18n => i18n}/i18n.qrc                   |  0
 lib/lib.pri                                   |  1 +
 {src/lib => lib}/qtlib/.gitignore             |  0
 {src/lib => lib}/qtlib/README.md              |  0
 {src/lib => lib}/qtlib/qtlib.pri              |  0
 {src/lib => lib}/qtlib/qtlib.pro              |  0
 {src/lib => lib}/qtlib/src/qtlib_config.cpp   |  0
 {src/lib => lib}/qtlib/src/qtlib_config.h     |  0
 {src/lib => lib}/qtlib/src/qtlib_dir.cpp      |  0
 {src/lib => lib}/qtlib/src/qtlib_dir.h        |  0
 {src/lib => lib}/qtlib/src/qtlib_file.cpp     |  0
 {src/lib => lib}/qtlib/src/qtlib_file.h       |  0
 {src/lib => lib}/qtlib/src/qtlib_json.cpp     |  0
 {src/lib => lib}/qtlib/src/qtlib_json.h       |  0
 .../qtlib/src/qtlib_networkresource.cpp       |  0
 .../qtlib/src/qtlib_networkresource.h         |  0
 {src/lib => lib}/qtlib/src/qtlib_ocsapi.cpp   |  0
 {src/lib => lib}/qtlib/src/qtlib_ocsapi.h     |  0
 {src/lib => lib}/qtlib/src/qtlib_package.cpp  |  0
 {src/lib => lib}/qtlib/src/qtlib_package.h    |  0
 ocs-url.pro                                   | 28 ++++---------------
 pkg/build.sh                                  |  8 +++---
 pkg/pkg.pri                                   | 13 +++++++++
 src/app/app.pri                               | 21 --------------
 44 files changed, 51 insertions(+), 49 deletions(-)
 create mode 100644 app/app.pri
 rename {src/app => app}/configs/application.json (100%)
 rename {src/app => app}/configs/configs.qrc (100%)
 rename {src/app => app}/configs/install_types.json (100%)
 rename {src/app => app}/configs/install_types_alias.json (100%)
 rename {src/app => app}/qml/main.qml (100%)
 rename {src/app => app}/qml/qml.qrc (100%)
 rename {src/app => app}/qml/scripts/Utility.js (100%)
 rename {src/app => app/src}/handlers/confighandler.cpp (100%)
 rename {src/app => app/src}/handlers/confighandler.h (100%)
 rename {src/app => app/src}/handlers/ocsurlhandler.cpp (100%)
 rename {src/app => app/src}/handlers/ocsurlhandler.h (100%)
 rename {src/app => app/src}/main.cpp (100%)
 create mode 100644 desktop/desktop.pri
 rename {src/desktop => desktop}/desktop.qrc (100%)
 rename {src/desktop => desktop}/ocs-url.desktop (100%)
 rename {src/desktop => desktop}/ocs-url.svg (100%)
 create mode 100644 i18n/i18n.pri
 rename {src/i18n => i18n}/i18n.pro (87%)
 rename {src/i18n => i18n}/i18n.qrc (100%)
 create mode 100644 lib/lib.pri
 rename {src/lib => lib}/qtlib/.gitignore (100%)
 rename {src/lib => lib}/qtlib/README.md (100%)
 rename {src/lib => lib}/qtlib/qtlib.pri (100%)
 rename {src/lib => lib}/qtlib/qtlib.pro (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_config.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_config.h (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_dir.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_dir.h (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_file.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_file.h (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_json.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_json.h (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_networkresource.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_networkresource.h (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_ocsapi.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_ocsapi.h (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_package.cpp (100%)
 rename {src/lib => lib}/qtlib/src/qtlib_package.h (100%)
 create mode 100644 pkg/pkg.pri
 delete mode 100644 src/app/app.pri

diff --git a/app/app.pri b/app/app.pri
new file mode 100644
index 0000000..af71e02
--- /dev/null
+++ b/app/app.pri
@@ -0,0 +1,21 @@
+QT += \
+    core \
+    gui \
+    qml \
+    quick \
+    svg
+
+HEADERS += \
+    $${PWD}/src/handlers/confighandler.h \
+    $${PWD}/src/handlers/ocsurlhandler.h
+
+SOURCES += \
+    $${PWD}/src/main.cpp \
+    $${PWD}/src/handlers/confighandler.cpp \
+    $${PWD}/src/handlers/ocsurlhandler.cpp
+
+RESOURCES += \
+    $${PWD}/configs/configs.qrc \
+    $${PWD}/qml/qml.qrc
+
+INCLUDEPATH += $${PWD}/src
diff --git a/src/app/configs/application.json b/app/configs/application.json
similarity index 100%
rename from src/app/configs/application.json
rename to app/configs/application.json
diff --git a/src/app/configs/configs.qrc b/app/configs/configs.qrc
similarity index 100%
rename from src/app/configs/configs.qrc
rename to app/configs/configs.qrc
diff --git a/src/app/configs/install_types.json b/app/configs/install_types.json
similarity index 100%
rename from src/app/configs/install_types.json
rename to app/configs/install_types.json
diff --git a/src/app/configs/install_types_alias.json b/app/configs/install_types_alias.json
similarity index 100%
rename from src/app/configs/install_types_alias.json
rename to app/configs/install_types_alias.json
diff --git a/src/app/qml/main.qml b/app/qml/main.qml
similarity index 100%
rename from src/app/qml/main.qml
rename to app/qml/main.qml
diff --git a/src/app/qml/qml.qrc b/app/qml/qml.qrc
similarity index 100%
rename from src/app/qml/qml.qrc
rename to app/qml/qml.qrc
diff --git a/src/app/qml/scripts/Utility.js b/app/qml/scripts/Utility.js
similarity index 100%
rename from src/app/qml/scripts/Utility.js
rename to app/qml/scripts/Utility.js
diff --git a/src/app/handlers/confighandler.cpp b/app/src/handlers/confighandler.cpp
similarity index 100%
rename from src/app/handlers/confighandler.cpp
rename to app/src/handlers/confighandler.cpp
diff --git a/src/app/handlers/confighandler.h b/app/src/handlers/confighandler.h
similarity index 100%
rename from src/app/handlers/confighandler.h
rename to app/src/handlers/confighandler.h
diff --git a/src/app/handlers/ocsurlhandler.cpp b/app/src/handlers/ocsurlhandler.cpp
similarity index 100%
rename from src/app/handlers/ocsurlhandler.cpp
rename to app/src/handlers/ocsurlhandler.cpp
diff --git a/src/app/handlers/ocsurlhandler.h b/app/src/handlers/ocsurlhandler.h
similarity index 100%
rename from src/app/handlers/ocsurlhandler.h
rename to app/src/handlers/ocsurlhandler.h
diff --git a/src/app/main.cpp b/app/src/main.cpp
similarity index 100%
rename from src/app/main.cpp
rename to app/src/main.cpp
diff --git a/deployment.pri b/deployment.pri
index a2a7b02..4e9bd38 100644
--- a/deployment.pri
+++ b/deployment.pri
@@ -3,7 +3,7 @@ unix:!ios:!android {
         PREFIX = /usr/local
     }
 
-    SRCDIR = $${PWD}/src
+    SRCDIR = $${PWD}
     BINDIR = $${PREFIX}/bin
     DATADIR = $${PREFIX}/share
 
diff --git a/desktop/desktop.pri b/desktop/desktop.pri
new file mode 100644
index 0000000..0c1a806
--- /dev/null
+++ b/desktop/desktop.pri
@@ -0,0 +1,3 @@
+RESOURCES += $${PWD}/desktop.qrc
+
+DISTFILES += $${PWD}/ocs-url.desktop
diff --git a/src/desktop/desktop.qrc b/desktop/desktop.qrc
similarity index 100%
rename from src/desktop/desktop.qrc
rename to desktop/desktop.qrc
diff --git a/src/desktop/ocs-url.desktop b/desktop/ocs-url.desktop
similarity index 100%
rename from src/desktop/ocs-url.desktop
rename to desktop/ocs-url.desktop
diff --git a/src/desktop/ocs-url.svg b/desktop/ocs-url.svg
similarity index 100%
rename from src/desktop/ocs-url.svg
rename to desktop/ocs-url.svg
diff --git a/i18n/i18n.pri b/i18n/i18n.pri
new file mode 100644
index 0000000..31b3fcf
--- /dev/null
+++ b/i18n/i18n.pri
@@ -0,0 +1 @@
+RESOURCES += $${PWD}/i18n.qrc
diff --git a/src/i18n/i18n.pro b/i18n/i18n.pro
similarity index 87%
rename from src/i18n/i18n.pro
rename to i18n/i18n.pro
index a2f872d..69dbabb 100644
--- a/src/i18n/i18n.pro
+++ b/i18n/i18n.pro
@@ -4,4 +4,4 @@ TRANSLATIONS += \
     messages.ts \
     messages.en_US.ts
 
-RESOURCES += i18n.qrc
+include(i18n.pri)
diff --git a/src/i18n/i18n.qrc b/i18n/i18n.qrc
similarity index 100%
rename from src/i18n/i18n.qrc
rename to i18n/i18n.qrc
diff --git a/lib/lib.pri b/lib/lib.pri
new file mode 100644
index 0000000..5343ea6
--- /dev/null
+++ b/lib/lib.pri
@@ -0,0 +1 @@
+include($${PWD}/qtlib/qtlib.pri)
diff --git a/src/lib/qtlib/.gitignore b/lib/qtlib/.gitignore
similarity index 100%
rename from src/lib/qtlib/.gitignore
rename to lib/qtlib/.gitignore
diff --git a/src/lib/qtlib/README.md b/lib/qtlib/README.md
similarity index 100%
rename from src/lib/qtlib/README.md
rename to lib/qtlib/README.md
diff --git a/src/lib/qtlib/qtlib.pri b/lib/qtlib/qtlib.pri
similarity index 100%
rename from src/lib/qtlib/qtlib.pri
rename to lib/qtlib/qtlib.pri
diff --git a/src/lib/qtlib/qtlib.pro b/lib/qtlib/qtlib.pro
similarity index 100%
rename from src/lib/qtlib/qtlib.pro
rename to lib/qtlib/qtlib.pro
diff --git a/src/lib/qtlib/src/qtlib_config.cpp b/lib/qtlib/src/qtlib_config.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_config.cpp
rename to lib/qtlib/src/qtlib_config.cpp
diff --git a/src/lib/qtlib/src/qtlib_config.h b/lib/qtlib/src/qtlib_config.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_config.h
rename to lib/qtlib/src/qtlib_config.h
diff --git a/src/lib/qtlib/src/qtlib_dir.cpp b/lib/qtlib/src/qtlib_dir.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_dir.cpp
rename to lib/qtlib/src/qtlib_dir.cpp
diff --git a/src/lib/qtlib/src/qtlib_dir.h b/lib/qtlib/src/qtlib_dir.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_dir.h
rename to lib/qtlib/src/qtlib_dir.h
diff --git a/src/lib/qtlib/src/qtlib_file.cpp b/lib/qtlib/src/qtlib_file.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_file.cpp
rename to lib/qtlib/src/qtlib_file.cpp
diff --git a/src/lib/qtlib/src/qtlib_file.h b/lib/qtlib/src/qtlib_file.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_file.h
rename to lib/qtlib/src/qtlib_file.h
diff --git a/src/lib/qtlib/src/qtlib_json.cpp b/lib/qtlib/src/qtlib_json.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_json.cpp
rename to lib/qtlib/src/qtlib_json.cpp
diff --git a/src/lib/qtlib/src/qtlib_json.h b/lib/qtlib/src/qtlib_json.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_json.h
rename to lib/qtlib/src/qtlib_json.h
diff --git a/src/lib/qtlib/src/qtlib_networkresource.cpp b/lib/qtlib/src/qtlib_networkresource.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_networkresource.cpp
rename to lib/qtlib/src/qtlib_networkresource.cpp
diff --git a/src/lib/qtlib/src/qtlib_networkresource.h b/lib/qtlib/src/qtlib_networkresource.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_networkresource.h
rename to lib/qtlib/src/qtlib_networkresource.h
diff --git a/src/lib/qtlib/src/qtlib_ocsapi.cpp b/lib/qtlib/src/qtlib_ocsapi.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_ocsapi.cpp
rename to lib/qtlib/src/qtlib_ocsapi.cpp
diff --git a/src/lib/qtlib/src/qtlib_ocsapi.h b/lib/qtlib/src/qtlib_ocsapi.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_ocsapi.h
rename to lib/qtlib/src/qtlib_ocsapi.h
diff --git a/src/lib/qtlib/src/qtlib_package.cpp b/lib/qtlib/src/qtlib_package.cpp
similarity index 100%
rename from src/lib/qtlib/src/qtlib_package.cpp
rename to lib/qtlib/src/qtlib_package.cpp
diff --git a/src/lib/qtlib/src/qtlib_package.h b/lib/qtlib/src/qtlib_package.h
similarity index 100%
rename from src/lib/qtlib/src/qtlib_package.h
rename to lib/qtlib/src/qtlib_package.h
diff --git a/ocs-url.pro b/ocs-url.pro
index 4f7a1de..5572f3e 100644
--- a/ocs-url.pro
+++ b/ocs-url.pro
@@ -6,28 +6,12 @@ CONFIG += c++11
 
 DEFINES += QT_DEPRECATED_WARNINGS
 
-RESOURCES += \
-    src/desktop/desktop.qrc \
-    src/i18n/i18n.qrc
+DISTFILES += README.md
 
-DISTFILES += \
-    README.md \
-    src/desktop/ocs-url.desktop \
-    pkg/build.sh \
-    pkg/ubuntu/debian/changelog \
-    pkg/ubuntu/debian/compat \
-    pkg/ubuntu/debian/control \
-    pkg/ubuntu/debian/copyright \
-    pkg/ubuntu/debian/rules \
-    pkg/ubuntu/debian/ocs-url.install \
-    pkg/fedora/ocs-url.spec \
-    pkg/arch/PKGBUILD \
-    pkg/snap/snapcraft.yaml \
-    pkg/snap/setup/gui/ocs-url.desktop \
-    pkg/appimage/appimage-desktopintegration
-
-include(src/lib/qtlib/qtlib.pri)
-
-include(src/app/app.pri)
+include(lib/lib.pri)
+include(app/app.pri)
+include(desktop/desktop.pri)
+include(i18n/i18n.pri)
+include(pkg/pkg.pri)
 
 include(deployment.pri)
diff --git a/pkg/build.sh b/pkg/build.sh
index 21a6720..7300894 100644
--- a/pkg/build.sh
+++ b/pkg/build.sh
@@ -108,13 +108,13 @@ build_appimage() {
     cd "${BUILDDIR}"
     mkdir -p "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin"
     install -m 755 -p "${BUILDDIR}/${PKGNAME}/ocs-url" "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url"
-    install -m 644 -p "${BUILDDIR}/${PKGNAME}/src/desktop/ocs-url.desktop" "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url.desktop"
-    install -m 644 -p "${BUILDDIR}/${PKGNAME}/src/desktop/ocs-url.svg" "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url.svg"
+    install -m 644 -p "${BUILDDIR}/${PKGNAME}/desktop/ocs-url.desktop" "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url.desktop"
+    install -m 644 -p "${BUILDDIR}/${PKGNAME}/desktop/ocs-url.svg" "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url.svg"
     install -m 755 -p /usr/bin/update-desktop-database "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin/update-desktop-database"
     install -m 755 -p /usr/bin/desktop-file-validate "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin/desktop-file-validate"
     install -m 755 -p /usr/bin/desktop-file-install "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin/desktop-file-install"
-    linuxdeployqt "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url" -qmldir="${BUILDDIR}/${PKGNAME}/src/app/qml" -verbose=2 -bundle-non-qt-libs # https://github.com/probonopd/linuxdeployqt/issues/25
-    linuxdeployqt "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url" -qmldir="${BUILDDIR}/${PKGNAME}/src/app/qml" -verbose=2 -bundle-non-qt-libs # twice because of #25
+    linuxdeployqt "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url" -qmldir="${BUILDDIR}/${PKGNAME}/app/qml" -verbose=2 -bundle-non-qt-libs # https://github.com/probonopd/linuxdeployqt/issues/25
+    linuxdeployqt "${BUILDDIR}/${PKGNAME}.AppDir/ocs-url" -qmldir="${BUILDDIR}/${PKGNAME}/app/qml" -verbose=2 -bundle-non-qt-libs # twice because of #25
     rm "${BUILDDIR}/${PKGNAME}.AppDir/AppRun"
     install -m 755 -p "${BUILDDIR}/${PKGNAME}/pkg/appimage/appimage-desktopintegration" "${BUILDDIR}/${PKGNAME}.AppDir/AppRun"
     linuxdeployqt --appimage-extract
diff --git a/pkg/pkg.pri b/pkg/pkg.pri
new file mode 100644
index 0000000..574cd20
--- /dev/null
+++ b/pkg/pkg.pri
@@ -0,0 +1,13 @@
+DISTFILES += \
+    $${PWD}/build.sh \
+    $${PWD}/ubuntu/debian/changelog \
+    $${PWD}/ubuntu/debian/compat \
+    $${PWD}/ubuntu/debian/control \
+    $${PWD}/ubuntu/debian/copyright \
+    $${PWD}/ubuntu/debian/rules \
+    $${PWD}/ubuntu/debian/ocs-url.install \
+    $${PWD}/fedora/ocs-url.spec \
+    $${PWD}/arch/PKGBUILD \
+    $${PWD}/snap/snapcraft.yaml \
+    $${PWD}/snap/setup/gui/ocs-url.desktop \
+    $${PWD}/appimage/appimage-desktopintegration
diff --git a/src/app/app.pri b/src/app/app.pri
deleted file mode 100644
index 15ac50a..0000000
--- a/src/app/app.pri
+++ /dev/null
@@ -1,21 +0,0 @@
-QT += \
-    core \
-    gui \
-    qml \
-    quick \
-    svg
-
-HEADERS += \
-    $${PWD}/handlers/confighandler.h \
-    $${PWD}/handlers/ocsurlhandler.h
-
-SOURCES += \
-    $${PWD}/main.cpp \
-    $${PWD}/handlers/confighandler.cpp \
-    $${PWD}/handlers/ocsurlhandler.cpp
-
-RESOURCES += \
-    $${PWD}/configs/configs.qrc \
-    $${PWD}/qml/qml.qrc
-
-INCLUDEPATH += $${PWD}
-- 
GitLab