mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 12:22:05 +08:00
Temporary commit
This commit is contained in:
@@ -21,8 +21,10 @@ namespace SpkUi
|
||||
|
||||
void LoadAppResources(QString pkgName, QString icon, QStringList screenshots, QStringList tags);
|
||||
void SetWebsiteLink(QString url);
|
||||
void SetPackagePath(QString url);
|
||||
|
||||
private:
|
||||
QString mPkgPath;
|
||||
|
||||
public slots:
|
||||
void ResourceAcquisitionFinished(int id, ResourceResult result);
|
||||
@@ -38,12 +40,16 @@ namespace SpkUi
|
||||
*mWebsite;
|
||||
SpkDetailEntry *mAuthor, *mContributor, *mSite, *mArch, *mSize;
|
||||
SpkStretchLayout *mDetailLay;
|
||||
QVBoxLayout *mMainLay, *mTitleLay, *mLay4MainArea;
|
||||
QVBoxLayout *mDetailsLay, *mTitleLay, *mMainLay;
|
||||
QHBoxLayout *mIconTitleLay;
|
||||
|
||||
// Bottom bar
|
||||
QWidget *mBottomBar;
|
||||
QPushButton *mBtnInstall, *mBtnDownload, *mBtnUninstall, *mBtnRequestUpdate, *mBtnReport;
|
||||
QHBoxLayout *mBottomBarLay;
|
||||
|
||||
signals:
|
||||
void RequestDownload(QString name, QString pkgName, QString path);
|
||||
};
|
||||
|
||||
class SpkDetailEntry : public QWidget
|
||||
|
||||
@@ -91,9 +91,11 @@ class SpkDownloadMgr : public QObject
|
||||
private slots:
|
||||
void WorkerFinish();
|
||||
void WorkerDownloadProgress(); ///< Be connected to ***QNetworkReply::readyRead***
|
||||
void WorkerError(QNetworkReply::NetworkError);
|
||||
void ProgressTimer();
|
||||
|
||||
private:
|
||||
void ProcessWorkerError(DownloadWorker &, int id);
|
||||
void LinkReplyWithMe(QNetworkReply*);
|
||||
void TryScheduleFailureRetries();
|
||||
void TryScheduleFailureRetries(int i); ///< Try schedule on a specific task slot.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <QProgressBar>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTime>
|
||||
|
||||
class SpkDownloadEntry : public QWidget
|
||||
{
|
||||
@@ -33,10 +34,10 @@ class SpkDownloadEntry : public QWidget
|
||||
InstallFailed
|
||||
};
|
||||
|
||||
public slots:
|
||||
void SetTotalBytes(qint64 total);
|
||||
void SetBasicInfo(QString name, QPixmap icon);
|
||||
void SetStatus(DownloadEntryStatus status);
|
||||
void SetProgress(int);
|
||||
void SetStatus(DownloadEntryStatus status, QString msg = "");
|
||||
void Progress(qint64 bytes);
|
||||
|
||||
private:
|
||||
QLabel *mIcon, *mMessage;
|
||||
@@ -49,4 +50,8 @@ class SpkDownloadEntry : public QWidget
|
||||
QHBoxLayout *mLayMsgs, *mLayMain;
|
||||
QVBoxLayout *mLayInfo;
|
||||
|
||||
// Download status data
|
||||
qint64 mTotalBytes, mDownloadedBytes;
|
||||
QTime mLastReportTime;
|
||||
QString mReadableTotalSize;
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "spksidebartree.h" // In place of #include <QTreeWidget>
|
||||
#include <QPointer>
|
||||
#include <QTimeLine>
|
||||
#include <QQueue>
|
||||
#include "spkfocuslineedit.h"
|
||||
#include "spkiconbutton.h"
|
||||
#include "page/spkpageuitest.h"
|
||||
@@ -47,6 +48,9 @@ namespace SpkUi
|
||||
QTreeWidget *mCategoryWidget;
|
||||
QVector<QTreeWidgetItem *> mUnusableItems; // Unselectable top level items; never changes
|
||||
|
||||
QTreeWidgetItem* mLastCategoryItem;
|
||||
int mLastCategoryPage;
|
||||
|
||||
public:
|
||||
SpkSidebarSelector(QObject *parent = nullptr) : QObject(parent)
|
||||
{
|
||||
@@ -69,6 +73,11 @@ namespace SpkUi
|
||||
&SpkSidebarSelector::TreeItemSelected);
|
||||
}
|
||||
void AddUnusableItem(QTreeWidgetItem *i) { mUnusableItems.append(i); }
|
||||
void GoBack()
|
||||
{
|
||||
emit SwitchToCategory(mLastCategoryPage, 0);
|
||||
mLastCategoryItem->setSelected(true);
|
||||
}
|
||||
|
||||
private slots:
|
||||
// We assume the objects in interest all have the correct properties
|
||||
@@ -91,7 +100,8 @@ namespace SpkUi
|
||||
mLastSelectedItem = nullptr;
|
||||
}
|
||||
mLastCheckedBtn = b;
|
||||
emit SwitchToPage(static_cast<SpkStackedPages>(b->property("spk_pageno").toInt()));
|
||||
auto id = b->property("spk_pageno").toInt();
|
||||
emit SwitchToPage(static_cast<SpkStackedPages>(id));
|
||||
}
|
||||
void TreeItemSelected(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
@@ -105,11 +115,11 @@ namespace SpkUi
|
||||
mLastCheckedBtn = nullptr;
|
||||
}
|
||||
mLastSelectedItem = item;
|
||||
auto id = item->data(column, RoleItemCategoryPageId).toInt();
|
||||
if(item->data(column, RoleItemIsCategory).toBool())
|
||||
emit SwitchToCategory(item->data(column, RoleItemCategoryPageId).toInt(), 0);
|
||||
emit SwitchToCategory(id, 0), mLastCategoryPage = id, mLastCategoryItem = item;
|
||||
else
|
||||
emit SwitchToPage(static_cast<SpkStackedPages>(
|
||||
item->data(column, RoleItemCategoryPageId).toInt()));
|
||||
emit SwitchToPage(static_cast<SpkStackedPages>(id));
|
||||
}
|
||||
void UnusableItemSelected(QTreeWidgetItem *i)
|
||||
{
|
||||
@@ -147,7 +157,7 @@ namespace SpkUi
|
||||
QVBoxLayout *VLaySidebar;
|
||||
QHBoxLayout *HLaySideTop;
|
||||
QLabel *StoreIcon;
|
||||
SpkIconButton *BtnSettings, *BtnFeedback, *BtnLogs, *BtnDayNight;
|
||||
SpkIconButton *BtnSettings, *BtnFeedback, *BtnLogs, *BtnDayNight, *BtnBack;
|
||||
SpkSidebarTree *CategoryWidget;
|
||||
QMap<int, QTreeWidgetItem> *CategoryItemMap;
|
||||
SpkSidebarSelector *SidebarMgr;
|
||||
|
||||
@@ -22,9 +22,10 @@ namespace SpkUtils
|
||||
|
||||
void DeleteReplyLater(QNetworkReply *aReply);
|
||||
|
||||
bool VerifyReplyJson(QNetworkReply *aReply, QJsonValue& aRetDoc);
|
||||
int VerifyReplyJson(QNetworkReply *aReply, QJsonValue& aRetDoc);
|
||||
|
||||
QString CutFileName(QString);
|
||||
QString CutPath(QString);
|
||||
QString BytesToSize(size_t s, int prec = 2);
|
||||
bool EnsureDirExists(QString path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user