aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-04-04 13:22:25 +0000
committerxiphon <xiphon@protonmail.com>2020-04-06 16:59:33 +0000
commit6ed7fcec67109602a6b1dbe390b4274b9467931e (patch)
tree4d983c69547036bc1c883d525ceb5d8e0425e3b7 /src/main
parentdf54439972b885476ccc13b468b17508493521c7 (diff)
downloadmonzero-gui-6ed7fcec67109602a6b1dbe390b4274b9467931e.tar.gz
monzero-gui-6ed7fcec67109602a6b1dbe390b4274b9467931e.tar.xz
monzero-gui-6ed7fcec67109602a6b1dbe390b4274b9467931e.zip
UpdateDialog: implement update download functionality
Diffstat (limited to 'src/main')
-rw-r--r--src/main/main.cpp2
-rw-r--r--src/main/oshelper.cpp13
-rw-r--r--src/main/oshelper.h2
3 files changed, 17 insertions, 0 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp
index c6c0ea52..c564c59f 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -61,6 +61,7 @@
#include "wallet/api/wallet2_api.h"
#include "Logger.h"
#include "MainApp.h"
+#include "qt/downloader.h"
#include "qt/ipc.h"
#include "qt/network.h"
#include "qt/utils.h"
@@ -295,6 +296,7 @@ int main(int argc, char *argv[])
// registering types for QML
qmlRegisterType<clipboardAdapter>("moneroComponents.Clipboard", 1, 0, "Clipboard");
+ qmlRegisterType<Downloader>("moneroComponents.Downloader", 1, 0, "Downloader");
// Temporary Qt.labs.settings replacement
qmlRegisterType<MoneroSettings>("moneroComponents.Settings", 1, 0, "MoneroSettings");
diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp
index 4402db6d..75c668f5 100644
--- a/src/main/oshelper.cpp
+++ b/src/main/oshelper.cpp
@@ -27,6 +27,8 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "oshelper.h"
+#include <QFileDialog>
+#include <QStandardPaths>
#include <QTemporaryFile>
#include <QDir>
#include <QDebug>
@@ -82,6 +84,11 @@ OSHelper::OSHelper(QObject *parent) : QObject(parent)
}
+QString OSHelper::downloadLocation() const
+{
+ return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+}
+
bool OSHelper::openContainingFolder(const QString &filePath) const
{
#if defined(Q_OS_WIN)
@@ -105,6 +112,12 @@ bool OSHelper::openContainingFolder(const QString &filePath) const
return QDesktopServices::openUrl(url);
}
+QString OSHelper::openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const
+{
+ const QString hint = (folder.isEmpty() ? "" : folder + QDir::separator()) + filename;
+ return QFileDialog::getSaveFileName(nullptr, title, hint);
+}
+
QString OSHelper::temporaryFilename() const
{
QString tempFileName;
diff --git a/src/main/oshelper.h b/src/main/oshelper.h
index 72f284af..ba498554 100644
--- a/src/main/oshelper.h
+++ b/src/main/oshelper.h
@@ -39,7 +39,9 @@ class OSHelper : public QObject
public:
explicit OSHelper(QObject *parent = 0);
+ Q_INVOKABLE QString downloadLocation() const;
Q_INVOKABLE bool openContainingFolder(const QString &filePath) const;
+ Q_INVOKABLE QString openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const;
Q_INVOKABLE QString temporaryFilename() const;
Q_INVOKABLE QString temporaryPath() const;
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;