'Open packages directory' button on dlc page
authorunc0rr
Mon, 23 Dec 2013 23:08:40 +0400
changeset 9829 1804dd141015
parent 9828 75457c7b84ee
child 9830 397e32abc794
'Open packages directory' button on dlc page
QTfrontend/ui/page/pagedata.cpp
QTfrontend/ui/page/pagedata.h
--- a/QTfrontend/ui/page/pagedata.cpp	Mon Dec 23 13:51:51 2013 -0500
+++ b/QTfrontend/ui/page/pagedata.cpp	Mon Dec 23 23:08:40 2013 +0400
@@ -26,6 +26,7 @@
 #include <QDebug>
 #include <QProgressBar>
 #include <QBuffer>
+#include <QDesktopServices>
 
 #include "pagedata.h"
 #include "databrowser.h"
@@ -48,10 +49,23 @@
     return pageLayout;
 }
 
+QLayout * PageDataDownload::footerLayoutDefinition()
+{
+    QHBoxLayout * bottomLayout = new QHBoxLayout();
+    bottomLayout->setStretch(0, 1);
+
+    pbOpenDir = addButton(tr("Open packages directory"), bottomLayout, 1, false);
+
+    bottomLayout->setStretch(2, 1);
+
+    return bottomLayout;
+}
+
 void PageDataDownload::connectSignals()
 {
     connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&)));
     connect(this, SIGNAL(goBack()), this, SLOT(onPageLeave()));
+    connect(pbOpenDir, SIGNAL(clicked()), this, SLOT(openPackagesDir()));
 }
 
 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent)
@@ -193,3 +207,9 @@
         //DataManager::instance().reload();
     }
 }
+
+void PageDataDownload::openPackagesDir()
+{
+    QString path = QDir::toNativeSeparators(cfgdir->absolutePath() + "/Data");
+    QDesktopServices::openUrl(QUrl("file:///" + path));
+}
--- a/QTfrontend/ui/page/pagedata.h	Mon Dec 23 13:51:51 2013 -0500
+++ b/QTfrontend/ui/page/pagedata.h	Mon Dec 23 23:08:40 2013 +0400
@@ -27,6 +27,7 @@
 class QNetworkReply;
 class QVBoxLayout;
 
+
 class PageDataDownload : public AbstractPage
 {
         Q_OBJECT
@@ -39,12 +40,14 @@
 
     protected:
         QLayout * bodyLayoutDefinition();
+        QLayout * footerLayoutDefinition();
         void connectSignals();
 
     private:
         DataBrowser *web;
         QHash<QNetworkReply*, QProgressBar *> progressBars;
         QVBoxLayout *progressBarsLayout;
+        QPushButtonWithSound * pbOpenDir;
 
         bool m_contentDownloaded; ///< true if something was downloaded since last page leave
 
@@ -54,6 +57,7 @@
         void pageDownloaded();
         void fileDownloaded();
         void downloadProgress(qint64, qint64);
+        void openPackagesDir();
 
         void onPageLeave();
 };