diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..a2ce144412 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.user +*.user.* diff --git a/main.cpp b/main.cpp index b1bd1a7292..ecc8b626f2 100644 --- a/main.cpp +++ b/main.cpp @@ -31,6 +31,7 @@ #include #include "clipboardAdapter.h" #include "filter.h" +#include "oscursor.h" int main(int argc, char *argv[]) { @@ -41,6 +42,10 @@ int main(int argc, char *argv[]) qmlRegisterType("moneroComponents", 1, 0, "Clipboard"); QQmlApplicationEngine engine; + + OSCursor cursor; + engine.rootContext()->setContextProperty("globalCursor", &cursor); + engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); QObject *rootObject = engine.rootObjects().first(); diff --git a/main.qml b/main.qml index d629a2485a..c1a1d5ec0c 100644 --- a/main.qml +++ b/main.qml @@ -355,17 +355,17 @@ ApplicationWindow { "images/resize.png" } - property int previousX: 0 - property int previousY: 0 + property var previousPosition onPressed: { - previousX = mouseX - previousY = mouseY + previousPosition = globalCursor.getPosition() } onPositionChanged: { if(!pressed) return - var dx = previousX - mouseX - var dy = previousY - mouseY + var pos = globalCursor.getPosition() + //var delta = previousPosition - pos + var dx = previousPosition.x - pos.x + var dy = previousPosition.y - pos.y if(appWindow.width - dx > parent.maxWidth) appWindow.width -= dx @@ -374,6 +374,7 @@ ApplicationWindow { if(appWindow.height - dy > parent.maxHeight) appWindow.height -= dy else appWindow.height = parent.maxHeight + previousPosition = pos } } @@ -390,13 +391,16 @@ ApplicationWindow { property var previousPosition anchors.fill: parent propagateComposedEvents: true - onPressed: previousPosition = Qt.point(mouseX, mouseY) + onPressed: previousPosition = globalCursor.getPosition() onPositionChanged: { if (pressedButtons == Qt.LeftButton) { - var dx = mouseX - previousPosition.x - var dy = mouseY - previousPosition.y + var pos = globalCursor.getPosition() + var dx = pos.x - previousPosition.x + var dy = pos.y - previousPosition.y + appWindow.x += dx appWindow.y += dy + previousPosition = pos } } } diff --git a/monero-core.pro b/monero-core.pro index 3f92b5dce2..de48d650f5 100644 --- a/monero-core.pro +++ b/monero-core.pro @@ -4,12 +4,14 @@ QT += qml quick widgets HEADERS += \ filter.h \ - clipboardAdapter.h + clipboardAdapter.h \ + oscursor.h SOURCES += main.cpp \ filter.cpp \ - clipboardAdapter.cpp + clipboardAdapter.cpp \ + oscursor.cpp lupdate_only { SOURCES = *.qml \ @@ -53,5 +55,6 @@ QML_IMPORT_PATH = include(deployment.pri) DISTFILES += \ - wizard/WizardManageWalletUI.qml + wizard/WizardManageWalletUI.qml \ + .gitignore diff --git a/monero-core.pro.user b/monero-core.pro.user deleted file mode 100644 index 7c1cd126b6..0000000000 --- a/monero-core.pro.user +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.3 MinGW 32bit - Desktop Qt 5.3 MinGW 32bit - qt.53.win32_mingw482_kit - 0 - 0 - 0 - - G:/RPA/build-bitmonero-Desktop_Qt_5_3_0_MinGW_32bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - budowania - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - czyszczenia - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - G:/RPA/build-bitmonero-Desktop_Qt_5_3_0_MinGW_32bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - budowania - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - czyszczenia - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 2 - - - 0 - instalacji - - ProjectExplorer.BuildSteps.Deploy - - 1 - Zainstaluj lokalnie - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - monero-core - - Qt4ProjectManager.Qt4RunConfiguration:G:/RPA/bitmonero/monero-core.pro - - monero-core.pro - false - false - - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.EnvironmentId - {20382c58-78e1-43a4-9d27-354b0656be87} - - - ProjectExplorer.Project.Updater.FileVersion - 15 - - diff --git a/oscursor.cpp b/oscursor.cpp new file mode 100644 index 0000000000..0d9c1acc21 --- /dev/null +++ b/oscursor.cpp @@ -0,0 +1,10 @@ +#include "oscursor.h" +#include +OSCursor::OSCursor(QObject *parent) + : QObject(parent) +{ +} +QPoint OSCursor::getPosition() const +{ + return QCursor::pos(); +} diff --git a/oscursor.h b/oscursor.h new file mode 100644 index 0000000000..db19227d0f --- /dev/null +++ b/oscursor.h @@ -0,0 +1,25 @@ +#ifndef OSCURSOR_H +#define OSCURSOR_H + + +#include +#include +#include +class OSCursor : public QObject +{ + Q_OBJECT + //QObject(); +public: + //QObject(QObject* aParent); + //OSCursor(); + explicit OSCursor(QObject *parent = 0); + Q_INVOKABLE QPoint getPosition() const; +}; + +//OSCursor::OSCursor() : QObject(NULL){ + +//} + + +//Q_DECLARE_METATYPE(OSCursor) +#endif // OSCURSOR_H