├── .dockerignore
├── debian
├── compat
├── source
│ ├── format
│ └── local-options
├── rules
├── gbp.conf
├── pardus-store.postinst
├── control
├── copyright
└── changelog
├── Pardus-Regular.otf
├── screenshots
├── ps-1.png
├── ps-2.png
├── ps-3.png
├── ps-4.png
├── ps-5.png
├── ps-6.png
└── ps-7.png
├── translations
└── pardus-store_tr.qm
├── file.qrc
├── translations.qrc
├── Dockerfile
├── .gitignore
├── src
├── condition.h
├── filehandler.h
├── singleton.h
├── dpkg-progress.h
├── iconprovider.h
├── packagehandler.h
├── namfactory.h
├── application.h
├── filehandler.cpp
├── applicationlistmodel.h
├── main.cpp
├── singleton.cpp
├── networkhandler.h
├── applicationdetail.h
├── dpkg-progress.cpp
├── application.cpp
├── applicationlistmodel.cpp
├── packagehandler.cpp
├── applicationdetail.cpp
├── helper.h
└── helper.cpp
├── qtquickcontrols2.conf
├── ui
├── Seperator.qml
├── FadeAnimation.qml
├── BottomDock.qml
├── ProgressBarCircle.qml
├── ApplicationList.qml
├── InfoDialog.qml
├── ConfirmationDialog.qml
├── SplashScreen.qml
├── QueueDialog.qml
├── SearchBar.qml
├── SurveyDetail.qml
└── NavigationBar.qml
├── .travis.yml
├── pardus-store.desktop
├── qml.qrc
├── README.md
├── tr.org.pardus.pkexec.pardus-store.policy
├── images.qrc
├── pardus-store.pro
└── images
├── home.svg
├── home-dark.svg
├── star-dark.svg
├── star.svg
├── all.svg
├── email.svg
├── email-dark.svg
├── categories.svg
├── categories-dark.svg
├── website.svg
├── website-dark.svg
├── settings.svg
├── settings-dark.svg
├── back.svg
├── front.svg
├── download.svg
├── download-dark.svg
├── rating-stars.svg
├── rating-stars-light.svg
├── search.svg
├── search-dark.svg
├── clear.svg
└── clear-dark.svg
/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 |
--------------------------------------------------------------------------------
/debian/compat:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/debian/source/format:
--------------------------------------------------------------------------------
1 | 3.0 (native)
2 |
--------------------------------------------------------------------------------
/debian/source/local-options:
--------------------------------------------------------------------------------
1 | extend-diff-ignore = ".drone.yml"
2 |
--------------------------------------------------------------------------------
/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 | export QT_SELECT := qt5
3 |
4 | %:
5 | dh $@
6 |
--------------------------------------------------------------------------------
/Pardus-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/Pardus-Regular.otf
--------------------------------------------------------------------------------
/debian/gbp.conf:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 |
3 | upstream-branch = master
4 | upstream-tag = %(version)s
5 |
--------------------------------------------------------------------------------
/debian/pardus-store.postinst:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | dpkg --add-architecture i386
6 |
--------------------------------------------------------------------------------
/screenshots/ps-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-1.png
--------------------------------------------------------------------------------
/screenshots/ps-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-2.png
--------------------------------------------------------------------------------
/screenshots/ps-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-3.png
--------------------------------------------------------------------------------
/screenshots/ps-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-4.png
--------------------------------------------------------------------------------
/screenshots/ps-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-5.png
--------------------------------------------------------------------------------
/screenshots/ps-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-6.png
--------------------------------------------------------------------------------
/screenshots/ps-7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/screenshots/ps-7.png
--------------------------------------------------------------------------------
/translations/pardus-store_tr.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yunusem/pardus-store/HEAD/translations/pardus-store_tr.qm
--------------------------------------------------------------------------------
/file.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | qtquickcontrols2.conf
4 | Pardus-Regular.otf
5 |
6 |
7 |
--------------------------------------------------------------------------------
/translations.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | translations/pardus-store_tr.qm
4 | translations/pardus-store_tr.ts
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM debian:stretch-slim
2 | MAINTAINER Yunusemre Şentürk
3 |
4 | RUN apt-get update && apt-get install \
5 | build-essential equivs devscripts --no-install-recommends -y
6 |
7 | COPY . /pardus-store
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # git ls-files --others --exclude-from=.git/info/exclude
2 | # Lines that start with '#' are comments.
3 | # For a project mostly in C, the following would be a good set of
4 | # exclude patterns (uncomment them if you want to use them):
5 | *.[oa]
6 |
7 | # editor backups
8 | *~
9 | *.sw?
10 |
11 | # qt specific stuff
12 | moc_*.cpp
13 | qrc_*.cpp
14 | .qmake.stash
15 |
16 | *.pro.user
17 |
--------------------------------------------------------------------------------
/src/condition.h:
--------------------------------------------------------------------------------
1 | #ifndef CONDITION_H
2 | #define CONDITION_H
3 |
4 | #include
5 |
6 | class Condition : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | enum State {
11 | Idle,
12 | Installed,
13 | Removed,
14 | Downloading,
15 | Installing,
16 | Removing
17 | };
18 | Q_ENUM(State)
19 | };
20 |
21 | #endif // CONDITION_H
22 |
--------------------------------------------------------------------------------
/qtquickcontrols2.conf:
--------------------------------------------------------------------------------
1 | ; This file can be edited to change the style of the application
2 | ; See Styling Qt Quick Controls 2 in the documentation for details:
3 | ; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html
4 |
5 | [Controls]
6 | Style=Material
7 |
8 | [Universal]
9 | Theme=Light
10 | ;Accent=Steel
11 |
12 | [Material]
13 | Theme=Dark
14 | Foreground=#E4E4E4
15 | Background=#2B2B2B
16 | Accent=#FFCB08
17 | Primary=#464646
18 |
--------------------------------------------------------------------------------
/src/filehandler.h:
--------------------------------------------------------------------------------
1 | #ifndef FILEHANDLER_H
2 | #define FILEHANDLER_H
3 |
4 | #include
5 |
6 | class FileHandler : public QObject
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit FileHandler(QObject *parent = 0);
11 | void correctSources();
12 |
13 | signals:
14 | void correctingSourcesFinished();
15 | void correctingSourcesFinishedWithError(const QString &err);
16 |
17 | };
18 |
19 | #endif // FILEHANDLER_H
20 |
--------------------------------------------------------------------------------
/ui/Seperator.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | Rectangle {
4 | id: seperator
5 | color: "transparent"
6 | property alias lineColor: line.color
7 | anchors {
8 | left: parent.left
9 | right: parent.right
10 | }
11 |
12 | Rectangle {
13 | id: line
14 | color: "#2B2B2B"
15 | width: parent.width
16 | height: 1
17 | radius: height / 2
18 | anchors.verticalCenter: parent.verticalCenter
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: required
2 |
3 | language: cpp
4 |
5 | services:
6 | - docker
7 |
8 | before_install:
9 | - docker build -t pardus/pardus-store .
10 | - docker run -d --name build pardus/pardus-store tail -f /dev/null
11 |
12 | install:
13 | - docker exec build /bin/sh -c 'cd /pardus-store; mk-build-deps -i -r -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"'
14 |
15 | script:
16 | - docker exec build /bin/sh -c 'cd /pardus-store; dpkg-buildpackage -b -uc'
17 |
--------------------------------------------------------------------------------
/pardus-store.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Name=Pardus Store
4 | Name[tr]=Pardus Mağaza
5 | Type=Application
6 | Comment=Simple Qt based application store
7 | Comment[tr]=Basit Qt tabanlı uygulama mağazası
8 | Terminal=false
9 | Exec=pkexec /usr/bin/pardus-store
10 | Icon=/usr/share/pardus/pardus-store/icon.svg
11 | MimeType=application/x-iso-image;
12 | Categories=Qt;Utility;
13 | Keywords=usb;disk;writer;burner;
14 | GenericName=Application Store
15 | GenericName[tr]=Uygulama Mağazası
16 |
--------------------------------------------------------------------------------
/ui/FadeAnimation.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | SequentialAnimation {
4 | id: fade
5 | property QtObject target
6 | property string child: "opacity"
7 | property int duration
8 | NumberAnimation {
9 | id: outAnimation
10 | target: fade.target
11 | property: fade.child
12 | duration: fade.duration / 2
13 | to: 0.0
14 | }
15 | PropertyAction { }
16 | NumberAnimation {
17 | id: inAnimation
18 | target: fade.target
19 | property: fade.child
20 | duration: fade.duration / 2
21 | to: 1.0
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/singleton.h:
--------------------------------------------------------------------------------
1 | #ifndef SINGLETON_H
2 | #define SINGLETON_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | class Singleton
9 | {
10 | public:
11 | Singleton(const QString &key);
12 | ~Singleton();
13 | bool isAnotherRunning();
14 | bool tryToRun();
15 | void release();
16 |
17 | private:
18 | const QString m_key;
19 | const QString m_memoryLockKey;
20 | const QString m_sharedMemoryKey;
21 |
22 | QSharedMemory m_sharedMemory;
23 | QSystemSemaphore m_systemSemaphore;
24 |
25 | Q_DISABLE_COPY( Singleton )
26 |
27 | };
28 |
29 | #endif // SINGLETON_H
30 |
--------------------------------------------------------------------------------
/ui/BottomDock.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.7
2 | import QtQuick.Controls 2.0
3 | import QtQuick.Window 2.0
4 | import QtQuick.Controls.Material 2.0
5 |
6 | Rectangle {
7 | width: parent.width * 20 / 21
8 | height: parent.height / 15
9 | z: 89
10 | anchors {
11 | bottom: parent.bottom
12 | right: parent.right
13 | }
14 |
15 | //Material.elevation: 3
16 | color: "transparent"
17 | property alias pageIndicator: indicator
18 |
19 |
20 |
21 |
22 | PageIndicator {
23 | id: indicator
24 | interactive: false
25 | visible: stackView.depth > 1
26 | count: stackView.depth
27 | currentIndex: stackView.depth -1
28 | anchors.top: parent.top
29 | anchors.horizontalCenter: parent.horizontalCenter
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | ui/main.qml
4 | ui/NavigationBar.qml
5 | ui/ApplicationDelegate.qml
6 | ui/SearchBar.qml
7 | ui/Home.qml
8 | ui/ApplicationDetail.qml
9 | ui/BottomDock.qml
10 | ui/SplashScreen.qml
11 | ui/QueueDialog.qml
12 | ui/ConfirmationDialog.qml
13 | ui/InfoDialog.qml
14 | ui/Settings.qml
15 | ui/ProgressBarCircle.qml
16 | ui/ApplicationList.qml
17 | ui/FadeAnimation.qml
18 | ui/Seperator.qml
19 | ui/SurveyDetail.qml
20 |
21 |
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://travis-ci.org/yunusem/pardus-store)
2 |
3 | # Pardus Store
4 |
5 | Pardus Store is an application store front-end for debian based operating systems.
6 |
7 | It is currently a work in progress. Maintenance is done by [Pardus](https://pardus.org.tr) team.
8 |
9 | Currently the server side of the store is on a test environment and can be updated to a dedicated server in the future.
10 |
11 | You can join the discussion on [Pardus Forums](https://forum.pardus.org.tr/t/pardus-magaza-beta-surumu-yayinlandi/4768/426).
12 |
13 |
14 | ## Screen Shots
15 |
16 | ### On Linux (Pardus 17.4 GNU/Linux)
17 |
18 | 
19 |
20 | 
21 |
22 | 
23 |
24 | 
25 |
26 | 
27 |
28 | 
29 |
30 | 
31 |
--------------------------------------------------------------------------------
/tr.org.pardus.pkexec.pardus-store.policy:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Pardus Developers
8 | http://www.pardus.org.tr/
9 |
10 |
11 | Authentication is required to run Pardus Store as root
12 | Pardus Mağazayı çalıştırmak için yetkilendirme gerekli
13 | pardus-store
14 |
15 | auth_admin
16 | auth_admin
17 | auth_admin
18 |
19 | /usr/bin/pardus-store
20 | true
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/dpkg-progress.h:
--------------------------------------------------------------------------------
1 | #ifndef DPKG_PROGRESS_H_
2 | #define DPKG_PROGRESS_H_
3 |
4 | #include
5 |
6 | class QString;
7 | class QSocketNotifier;
8 |
9 | class DpkgProgress : public QObject
10 | {
11 | Q_OBJECT
12 | public:
13 | DpkgProgress(QObject *parent = nullptr);
14 | virtual ~DpkgProgress();
15 |
16 | int statusFd();
17 |
18 | signals:
19 | void dpkgProgress(const QString &status, const QString &pkg,
20 | int value, const QString &desc);
21 |
22 | private slots:
23 | void onReadable();
24 |
25 | private:
26 | size_t avail() const;
27 | void processLine(const char *s);
28 | void notifyProgress(QStringList line, int percent = -1);
29 |
30 | QStringList m_line;
31 | QSocketNotifier *m_notifier;
32 |
33 | static const unsigned int BUF_SIZE = 128;
34 | char buf[BUF_SIZE], *pos;
35 | int pipefd, wrend;
36 | };
37 |
38 | inline size_t DpkgProgress::avail() const
39 | {
40 | return &buf[BUF_SIZE] - pos;
41 | }
42 |
43 | #endif /* end of include guard: DPKG_PROGRESS_H_ */
44 |
--------------------------------------------------------------------------------
/debian/control:
--------------------------------------------------------------------------------
1 | Source: pardus-store
2 | Section: utils
3 | Priority: optional
4 | Maintainer: Yunusemre Şentürk
5 | Build-Depends: debhelper (>= 9),
6 | libc6,
7 | libgcc1,
8 | libgcc-6-dev,
9 | libgl1-mesa-glx | libgl1,
10 | libqt5core5a,
11 | libqt5gui5,
12 | libqt5network5,
13 | libqt5qml5,
14 | libqt5quick5,
15 | libqt5svg5-dev,
16 | libqt5widgets5,
17 | libstdc++6,
18 | qtdeclarative5-dev
19 | Standards-Version: 3.9.8
20 | Homepage: http://pardus.org.tr
21 |
22 | Package: pardus-store
23 | Architecture: amd64
24 | Depends: ${shlibs:Depends}, ${misc:Depends},
25 | apt-transport-https,
26 | libqt5svg5,
27 | libnotify-bin,
28 | policykit-1,
29 | qml-module-qtquick-controls2,
30 | qml-module-qtquick2,
31 | qml-module-qtgraphicaleffects,
32 | qml-module-qtquick-controls,
33 | qml-module-qtquick-templates2
34 | Recommends: pardus-icon-theme
35 | Description: Pardus Application Store
36 | Qt based nice looking simple to use responsive application store.
37 |
--------------------------------------------------------------------------------
/src/iconprovider.h:
--------------------------------------------------------------------------------
1 | #ifndef ICONPROVIDER_H
2 | #define ICONPROVIDER_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #define default_icon_theme "pardus"
9 |
10 | class IconProvider : public QQuickImageProvider
11 | {
12 | public:
13 | IconProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap)
14 | {
15 |
16 | }
17 | virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
18 | {
19 | if (size) {
20 | *size = QSize(64, 64);
21 | }
22 | const QIcon defaultIcon = QIcon::fromTheme("image-missing",QIcon(id));
23 | defaultIcon.setThemeName(default_icon_theme);
24 | QIcon icon = QIcon::fromTheme(id, defaultIcon);
25 | icon.setThemeName(default_icon_theme);
26 |
27 | QPixmap pixmap = icon.pixmap(icon.actualSize(QSize(requestedSize.width() > 0 ? requestedSize.width() : 64,
28 | requestedSize.height() > 0 ? requestedSize.height() : 64)));
29 |
30 |
31 | return pixmap;
32 | }
33 |
34 | };
35 |
36 | #endif // ICONPROVIDER_H
37 |
--------------------------------------------------------------------------------
/debian/copyright:
--------------------------------------------------------------------------------
1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2 | Upstream-Name: pardus-store
3 | Source: https://github.com/yunusem/pardus-store
4 |
5 |
6 |
7 | Files: *
8 | Copyright: 2018 Yunusemre Senturk
9 | License: GPL-3.0+
10 |
11 | License: GPL-3.0+
12 | This program is free software: you can redistribute it and/or modify
13 | it under the terms of the GNU General Public License as published by
14 | the Free Software Foundation, either version 3 of the License, or
15 | (at your option) any later version.
16 | .
17 | This package is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | GNU General Public License for more details.
21 | .
22 | You should have received a copy of the GNU General Public License
23 | along with this program. If not, see .
24 | .
25 | On Debian systems, the complete text of the GNU General
26 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
27 |
28 |
29 |
--------------------------------------------------------------------------------
/images.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/home.svg
4 | images/all.svg
5 | images/settings.svg
6 | images/star.svg
7 | images/search.svg
8 | images/icon.svg
9 | images/back.svg
10 | images/front.svg
11 | images/categories.svg
12 | images/rating-stars.svg
13 | images/email.svg
14 | images/website.svg
15 | images/download.svg
16 | images/settings-dark.svg
17 | images/categories-dark.svg
18 | images/home-dark.svg
19 | images/search-dark.svg
20 | images/download-dark.svg
21 | images/star-dark.svg
22 | images/rating-stars-light.svg
23 | images/clear-dark.svg
24 | images/clear.svg
25 | images/website-dark.svg
26 | images/email-dark.svg
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/packagehandler.h:
--------------------------------------------------------------------------------
1 | #ifndef PACKAGEHANDLER_H
2 | #define PACKAGEHANDLER_H
3 |
4 | #include
5 | #include
6 | class QProcess;
7 | class QByteArray;
8 | class DpkgProgress;
9 |
10 | class PackageHandler : public QObject
11 | {
12 | Q_OBJECT
13 | public:
14 | explicit PackageHandler(QObject *parent = 0);
15 | ~PackageHandler();
16 | private:
17 | QProcess *p;
18 | DpkgProgress *dpkg;
19 | int m_percent;
20 | QString m_status;
21 |
22 | signals:
23 | void finished(int code);
24 | void dpkgProgressStatus(const QString &status, const QString &pkg, int value, const QString &desc);
25 |
26 | public slots:
27 | void updateCache();
28 | void install(const QString &pkg);
29 | void remove(const QString &pkg);
30 | bool terminate();
31 | void onFinished(int code);
32 | QString getPolicy(const QString &pkg) const;
33 | QString getShow(const QString &pkg) const;
34 | QString getSearch(const QString &pkg) const;
35 | QByteArray getError();
36 | QByteArray getOutput();
37 |
38 | private slots:
39 | void onDpkgProgress(const QString &status, const QString &pkg,
40 | int value, const QString &desc);
41 |
42 | };
43 |
44 | #endif // PACKAGEHANDLER_H
45 |
--------------------------------------------------------------------------------
/pardus-store.pro:
--------------------------------------------------------------------------------
1 | QT += qml quick widgets svg network
2 |
3 | CONFIG += c++11
4 |
5 | SOURCES += src/main.cpp \
6 | src/helper.cpp \
7 | src/filehandler.cpp \
8 | src/packagehandler.cpp \
9 | src/applicationlistmodel.cpp \
10 | src/networkhandler.cpp \
11 | src/applicationdetail.cpp \
12 | src/singleton.cpp \
13 | src/dpkg-progress.cpp \
14 | src/application.cpp
15 |
16 | HEADERS += \
17 | src/helper.h \
18 | src/filehandler.h \
19 | src/packagehandler.h \
20 | src/iconprovider.h \
21 | src/applicationlistmodel.h \
22 | src/networkhandler.h \
23 | src/applicationdetail.h \
24 | src/singleton.h \
25 | src/dpkg-progress.h \
26 | src/application.h \
27 | src/namfactory.h \
28 | src/condition.h
29 |
30 | TARGET = pardus-store
31 |
32 | RESOURCES += qml.qrc file.qrc \
33 | images.qrc \
34 | translations.qrc
35 |
36 | DEFINES += QT_DEPRECATED_WARNINGS
37 |
38 | target.path = /usr/bin
39 |
40 | desktop_file.files = pardus-store.desktop
41 | desktop_file.path = /usr/share/applications/
42 |
43 | icon.files = images/icon.svg
44 | icon.commands = mkdir -p /usr/share/pardus/pardus-store
45 | icon.path = /usr/share/pardus/pardus-store
46 |
47 | policy.files = tr.org.pardus.pkexec.pardus-store.policy
48 | policy.commands = mkdir -p /usr/share/polkit-1/actions
49 | policy.path = /usr/share/polkit-1/actions
50 |
51 | INSTALLS += target desktop_file icon policy
52 |
53 | #LIBS += -lapt-pkg
54 |
55 |
--------------------------------------------------------------------------------
/src/namfactory.h:
--------------------------------------------------------------------------------
1 | #ifndef NAMFACTORY_H
2 | #define NAMFACTORY_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | #define CACHE_PATH "/.cache/pardus-store/"
14 |
15 | class StoreNetworkAccessManager : public QNetworkAccessManager
16 | {
17 | public:
18 | StoreNetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent) { }
19 |
20 | protected:
21 | QNetworkReply *createRequest(Operation operation, const QNetworkRequest &request, QIODevice *outgoingData = nullptr) override
22 | {
23 | QNetworkRequest cacheRequest(request);
24 | cacheRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
25 | (networkAccessible() == QNetworkAccessManager::Accessible) ? QNetworkRequest::PreferCache : QNetworkRequest::AlwaysCache);
26 | return QNetworkAccessManager::createRequest(operation, cacheRequest, outgoingData);
27 | }
28 | };
29 |
30 | class NamFactory : public QQmlNetworkAccessManagerFactory
31 | {
32 | public:
33 | QNetworkAccessManager *create(QObject *parent) override;
34 |
35 | };
36 |
37 |
38 | QNetworkAccessManager *NamFactory::create(QObject *parent)
39 | {
40 | QNetworkAccessManager *nam = new StoreNetworkAccessManager(parent);
41 | QNetworkDiskCache *cache = new QNetworkDiskCache(nam);
42 | cache->setCacheDirectory(QDir::homePath().append(QString(CACHE_PATH)));
43 | nam->setCache(cache);
44 | return nam;
45 | }
46 |
47 | #endif // NAMFACTORY_H
48 |
--------------------------------------------------------------------------------
/src/application.h:
--------------------------------------------------------------------------------
1 | #ifndef APPLICATION_H
2 | #define APPLICATION_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | class Application
9 | {
10 | public:
11 | Application(const QString &name);
12 |
13 | QString name() const;
14 | QString version() const;
15 | unsigned int downloadcount();
16 | QString downloadsize() const;
17 | QString category() const;
18 | QString categoryLocal() const;
19 | QString prettyname() const;
20 | QString exec() const;
21 | QString state() const;
22 | QString search() const;
23 | double rating() const;
24 | bool installed() const;
25 | bool inqueue() const;
26 | bool nonfree() const;
27 |
28 | void setVersion(const QString &version);
29 | void setDownloadcount(const unsigned int &downloadcount);
30 | void setDownloadsize(const QString &downloadsize);
31 | void setCategory(const QHash &category);
32 | void setPrettyname (const QHash &prettyname);
33 | void setExec(const QString &exec);
34 | void setState(const QString &state);
35 | void setRating(const double &rating);
36 | void setInstalled(bool installed);
37 | void setInQueue(bool inqueue);
38 | void setNonfree(bool nonfree);
39 |
40 | private:
41 | QString m_name;
42 | QString m_version;
43 | unsigned int m_downloadcount;
44 | QString m_downloadsize;
45 | QHash m_category;
46 | QHash m_prettyname;
47 | QString m_exec;
48 | QString m_state;
49 | QString m_search;
50 | double m_rating;
51 | bool m_installed;
52 | bool m_inqueue;
53 | bool m_nonfree;
54 | };
55 |
56 | #endif // APPLICATION_H
57 |
--------------------------------------------------------------------------------
/src/filehandler.cpp:
--------------------------------------------------------------------------------
1 | #include "filehandler.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #define SOURCES_FILE "/etc/apt/sources.list"
9 | #define SOURCES_DIR "/etc/apt/sources.list.d"
10 |
11 | FileHandler::FileHandler(QObject *parent) : QObject(parent)
12 | {
13 |
14 | }
15 |
16 | void FileHandler::correctSources()
17 | {
18 | QFile file(SOURCES_FILE);
19 | if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
20 | emit correctingSourcesFinishedWithError(file.errorString());
21 | return;
22 | }
23 |
24 | QDir dir(SOURCES_DIR);
25 | dir.setNameFilters(QStringList() << "*.*");
26 | dir.setFilter(QDir::Files);
27 |
28 | foreach(QString dirFile, dir.entryList())
29 | {
30 | if(!dir.remove(dirFile)) {
31 | emit correctingSourcesFinishedWithError("Could not delete " + dirFile);
32 | return;
33 | }
34 | }
35 |
36 | QDateTime time = QDateTime::currentDateTime();
37 |
38 | QTextStream out(&file);
39 | out << "### The Official Pardus Package Repositories ###" << "\n\n"
40 | << "deb http://depo.pardus.org.tr/pardus onyedi main contrib non-free" << "\n"
41 | << "# deb-src http://depo.pardus.org.tr/pardus onyedi main contrib non-free" << "\n\n"
42 | << "deb http://depo.pardus.org.tr/guvenlik onyedi main contrib non-free" << "\n"
43 | << "# deb-src http://depo.pardus.org.tr/guvenlik onyedi main contrib non-free" << "\n\n"
44 | << "### This section generated by Pardus Store at "
45 | << time.toString("hh:mm:ss - dd.MM.yyyy") << " ###\n";
46 |
47 | file.close();
48 | emit correctingSourcesFinished();
49 | }
50 |
--------------------------------------------------------------------------------
/src/applicationlistmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef APPLICATIONLISTMODEL_H
2 | #define APPLICATIONLISTMODEL_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "application.h"
9 |
10 | enum Roles {
11 | NameRole = Qt::UserRole +1,
12 | VersionRole,
13 | DownloadSizeRole,
14 | CategoryRole,
15 | PrettyNameRole,
16 | ExecRole,
17 | StateRole,
18 | RatingRole,
19 | InstalledRole,
20 | InQueueRole,
21 | NonFreeRole,
22 | SearchRole
23 | };
24 |
25 | class ApplicationListModel : public QAbstractListModel
26 | {
27 | Q_OBJECT
28 | public:
29 | ApplicationListModel(QObject* parent = 0);
30 | ~ApplicationListModel();
31 | void addData(const Application &app);
32 | int rowCount(const QModelIndex & parent = QModelIndex()) const;
33 | QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
34 | bool setData(const QModelIndex &index, const QVariant &value, int role);
35 | bool setInstallStatusAtIndex(const int &index, const bool s);
36 |
37 | protected:
38 | QHash roleNames() const;
39 | private:
40 | QList lst;
41 | };
42 |
43 |
44 | class FilterProxyModel : public QSortFilterProxyModel
45 | {
46 | Q_OBJECT
47 | public:
48 |
49 | FilterProxyModel(QObject* parent = 0);
50 |
51 | ~FilterProxyModel();
52 |
53 | Q_INVOKABLE void setFilterString(QString s, bool isSearch);
54 | Q_INVOKABLE QString getFilterString() const;
55 |
56 | };
57 |
58 | class ListCover : public QObject
59 | {
60 | Q_OBJECT
61 |
62 | public:
63 | static void setInstance(ApplicationListModel* p);
64 | static ApplicationListModel* l;
65 |
66 | };
67 |
68 |
69 | #endif // APPLICATIONLISTMODEL_H
70 |
--------------------------------------------------------------------------------
/images/home.svg:
--------------------------------------------------------------------------------
1 |
2 |
58 |
--------------------------------------------------------------------------------
/images/home-dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
58 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "src/condition.h"
2 | #include "src/helper.h"
3 | #include "src/iconprovider.h"
4 | #include "src/applicationlistmodel.h"
5 | #include "src/singleton.h"
6 | #include "src/namfactory.h"
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | int main(int argc, char *argv[])
17 | {
18 | Singleton singleton("pardus-application-store");
19 | if (!singleton.tryToRun()) {
20 | return 0;
21 | }
22 | qmlRegisterType("ps.condition",1,0,"Condition");
23 | qmlRegisterType("ps.helper",1,0,"Helper");
24 | QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
25 | QGuiApplication::setWindowIcon(QIcon(":/images/icon.svg"));
26 | QGuiApplication app(argc, argv);
27 |
28 | app.setOrganizationName("pardus");
29 | app.setOrganizationDomain("www.pardus.org.tr");
30 | app.setApplicationName("pardus-store");
31 | app.setFont(QFont("Noto Sans"));
32 | ApplicationListModel listModel;
33 | ListCover::setInstance(&listModel);
34 | FilterProxyModel filterModel;
35 | filterModel.setSourceModel(&listModel);
36 | filterModel.setSortRole(NameRole);
37 |
38 | QTranslator t;
39 | if (t.load(":/translations/pardus-store_" + QLocale::system().name())) {
40 | app.installTranslator(&t);
41 | } else {
42 | qDebug() << "Could not load the translation";
43 | }
44 |
45 | QQmlApplicationEngine engine;
46 | QQmlContext *context = engine.rootContext();
47 | context->setContextProperty("applicationModel", &filterModel);
48 | engine.addImageProvider(QLatin1String("application"), new IconProvider);
49 | engine.setNetworkAccessManagerFactory(new NamFactory);
50 | engine.load(QUrl(QLatin1String("qrc:/ui/main.qml")));
51 |
52 |
53 | return app.exec();
54 | }
55 |
--------------------------------------------------------------------------------
/src/singleton.cpp:
--------------------------------------------------------------------------------
1 | #include "singleton.h"
2 | #include
3 |
4 | namespace
5 | {
6 |
7 | QString generateKeyHash( const QString& key, const QString& salt )
8 | {
9 | QByteArray data;
10 |
11 | data.append( key.toUtf8() );
12 | data.append( salt.toUtf8() );
13 | data = QCryptographicHash::hash( data, QCryptographicHash::Sha1 ).toHex();
14 |
15 | return data;
16 | }
17 |
18 | }
19 |
20 | Singleton::Singleton( const QString &key )
21 | : m_key( key )
22 | , m_memoryLockKey( generateKeyHash( key, "_m_memoryLockKey" ) )
23 | , m_sharedMemoryKey( generateKeyHash( key, "_m_sharedMemoryKey" ) )
24 | , m_sharedMemory( m_sharedMemoryKey )
25 | , m_systemSemaphore( m_memoryLockKey, 1 )
26 | {
27 | m_systemSemaphore.acquire();
28 | {
29 | QSharedMemory fix( m_sharedMemoryKey );
30 | fix.attach();
31 | }
32 | m_systemSemaphore.release();
33 | }
34 |
35 | Singleton::~Singleton()
36 | {
37 | release();
38 | }
39 |
40 | bool Singleton::isAnotherRunning()
41 | {
42 | if ( m_sharedMemory.isAttached() ) {
43 | return false;
44 | }
45 | m_systemSemaphore.acquire();
46 | const bool isRunning = m_sharedMemory.attach();
47 | if ( isRunning ) {
48 | m_sharedMemory.detach();
49 | }
50 | m_systemSemaphore.release();
51 |
52 | return isRunning;
53 | }
54 |
55 | bool Singleton::tryToRun()
56 | {
57 | if ( isAnotherRunning() ) {
58 | return false;
59 | }
60 | m_systemSemaphore.acquire();
61 | const bool result = m_sharedMemory.create( sizeof( quint64 ) );
62 | m_systemSemaphore.release();
63 | if ( !result ) {
64 | release();
65 | return false;
66 | }
67 | return true;
68 | }
69 |
70 | void Singleton::release()
71 | {
72 | m_systemSemaphore.acquire();
73 | if ( m_sharedMemory.isAttached() ) {
74 | m_sharedMemory.detach();
75 | }
76 | m_systemSemaphore.release();
77 | }
78 |
--------------------------------------------------------------------------------
/images/star-dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
57 |
--------------------------------------------------------------------------------
/images/star.svg:
--------------------------------------------------------------------------------
1 |
2 |
57 |
--------------------------------------------------------------------------------
/images/all.svg:
--------------------------------------------------------------------------------
1 |
2 |
58 |
--------------------------------------------------------------------------------
/images/email.svg:
--------------------------------------------------------------------------------
1 |
2 |
57 |
--------------------------------------------------------------------------------
/images/email-dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
57 |
--------------------------------------------------------------------------------
/ui/ProgressBarCircle.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQml 2.2
3 |
4 | Item {
5 | id: progressbarcircle
6 |
7 | width: 200
8 | height: 200
9 |
10 | property real value : 0.0
11 | property real maximumValue : 100
12 | property real arcEnd: value * (Math.PI * 1.5) / maximumValue
13 | property real thickness: 10
14 | property int animationDuration: 250
15 | property string colorCircle: "#111111"
16 | property string colorBackground: "#aaaaaa"
17 |
18 | onArcEndChanged: canvas.requestPaint()
19 |
20 | onColorCircleChanged: {
21 | value = 0.0
22 | }
23 |
24 | onValueChanged: {
25 | if(value >= maximumValue) {
26 | value = maximumValue
27 | }
28 | }
29 |
30 | Behavior on value {
31 | enabled: animate
32 | NumberAnimation {
33 | easing.type: Easing.OutExpo
34 | duration: animationDuration
35 | }
36 | }
37 |
38 | Text {
39 | anchors {
40 | horizontalCenter: parent.horizontalCenter
41 | bottom: parent.bottom
42 | bottomMargin: thickness - 3
43 | }
44 | smooth: true
45 | text: value.toFixed(0) + "%"
46 | font.pointSize: thickness * 20 / 9
47 | color: value == 0 ? "#111111" : colorCircle
48 | }
49 |
50 | Canvas {
51 | id: canvas
52 | anchors.fill: parent
53 | anchors.margins: thickness / 3
54 | rotation: 135
55 | layer.enabled: true
56 | layer.smooth: true
57 | onPaint: {
58 | var ctx = getContext("2d")
59 | var x = width / 2
60 | var y = height / 2
61 | var start = 0
62 | var end = parent.arcEnd
63 | ctx.reset()
64 | ctx.beginPath();
65 | ctx.arc(x, y, (width / 2 - 5) - thickness , 0, Math.PI * 1.5, false)
66 | ctx.lineWidth = thickness
67 | ctx.strokeStyle = colorBackground
68 | ctx.stroke()
69 | ctx.beginPath();
70 | ctx.arc(x, y, (width / 2 - 5) - thickness , start, end, false)
71 | ctx.lineWidth = thickness
72 | ctx.strokeStyle = colorCircle
73 | ctx.stroke()
74 |
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/networkhandler.h:
--------------------------------------------------------------------------------
1 | #ifndef NETWORKHANDLER_H
2 | #define NETWORKHANDLER_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include