diff --git a/LeftPanel.qml b/LeftPanel.qml index 10037ffc..d97d9bfc 100644 --- a/LeftPanel.qml +++ b/LeftPanel.qml @@ -34,15 +34,15 @@ Rectangle { Image { id: logo - anchors.horizontalCenter: parent.horizontalCenter + anchors.left: parent.left + anchors.leftMargin: 50 source: "images/moneroLogo.png" } Image { - anchors.right: logo.left + anchors.left: parent.left anchors.verticalCenter: logo.verticalCenter - anchors.verticalCenterOffset: 5 - anchors.rightMargin: 20 + anchors.leftMargin: 19 source: appWindow.rightPanelExpanded ? "images/expandRightPanel.png" : "images/collapseRightPanel.png" } diff --git a/bitmonero.pro b/bitmonero.pro index 3904b44c..5cfbbf37 100644 --- a/bitmonero.pro +++ b/bitmonero.pro @@ -3,7 +3,8 @@ TEMPLATE = app QT += qml quick widgets SOURCES += main.cpp \ - filter.cpp + filter.cpp \ + clipboardAdapter.cpp RESOURCES += qml.qrc @@ -14,4 +15,5 @@ QML_IMPORT_PATH = include(deployment.pri) HEADERS += \ - filter.h + filter.h \ + clipboardAdapter.h diff --git a/bitmonero.pro.user b/bitmonero.pro.user index 6b4a1b04..82647009 100644 --- a/bitmonero.pro.user +++ b/bitmonero.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/clipboardAdapter.cpp b/clipboardAdapter.cpp new file mode 100644 index 00000000..1d5d2d71 --- /dev/null +++ b/clipboardAdapter.cpp @@ -0,0 +1,12 @@ +#include "clipboardAdapter.h" + +clipboardAdapter::clipboardAdapter(QObject *parent) : + QObject(parent) +{ + m_pClipboard = QGuiApplication::clipboard(); +} + +void clipboardAdapter::setText(const QString &text) { + m_pClipboard->setText(text, QClipboard::Clipboard); + m_pClipboard->setText(text, QClipboard::Selection); +} diff --git a/clipboardAdapter.h b/clipboardAdapter.h new file mode 100644 index 00000000..239b699a --- /dev/null +++ b/clipboardAdapter.h @@ -0,0 +1,19 @@ +#ifndef CLIPBOARDADAPTER_H +#define CLIPBOARDADAPTER_H + +#include +#include +#include + +class clipboardAdapter : public QObject +{ + Q_OBJECT +public: + explicit clipboardAdapter(QObject *parent = 0); + Q_INVOKABLE void setText(const QString &text); + +private: + QClipboard *m_pClipboard; +}; + +#endif // CLIPBOARDADAPTER_H diff --git a/components/DashboardTable.qml b/components/DashboardTable.qml index cbd1c8d0..1b0d0f69 100644 --- a/components/DashboardTable.qml +++ b/components/DashboardTable.qml @@ -1,5 +1,6 @@ import QtQuick 2.0 import "../components" +import moneroComponents 1.0 ListView { id: listView @@ -36,30 +37,39 @@ ListView { } Text { - id: paymentIdText - width: text.length ? 120 : 0 + id: descriptionText + width: text.length ? (descriptionArea.containsMouse ? parent.width - x - 12 : 120) : 0 anchors.verticalCenter: dot.verticalCenter font.family: "Arial" font.bold: true font.pixelSize: 19 color: "#444444" elide: Text.ElideRight - text: paymentId + text: description + + MouseArea { + id: descriptionArea + anchors.fill: parent + hoverEnabled: true + } } Item { //separator - width: paymentIdText.width ? 12 : 0 + width: descriptionText.width ? 12 : 0 height: 14 + visible: !descriptionArea.containsMouse } Text { + id: addressText anchors.verticalCenter: dot.verticalCenter width: parent.width - x - 12 elide: Text.ElideRight font.family: "Arial" font.pixelSize: 14 color: "#545454" - text: description.length > 0 ? description : address + text: address + visible: !descriptionArea.containsMouse } } @@ -173,12 +183,22 @@ ListView { color: "#DBDBDB" } + ListModel { + id: dropModel + ListElement { name: "Copy address to clipboard"; icon: "../images/dropdownCopy.png" } + ListElement { name: "Add to address book"; icon: "../images/dropdownAdd.png" } + ListElement { name: "Send to same destination"; icon: "../images/dropdownSend.png" } + ListElement { name: "Find similar transactions"; icon: "../images/dropdownSearch.png" } + } + + Clipboard { id: clipboard } TableDropdown { id: dropdown anchors.right: parent.right anchors.bottom: parent.bottom anchors.bottomMargin: 11 anchors.rightMargin: 5 + dataModel: dropModel onExpandedChanged: { if(listView.previousItem !== undefined && listView.previousItem !== delegate) listView.previousItem.collapseDropdown() @@ -189,6 +209,10 @@ ListView { } } onCollapsed: delegate.z = 0 + onOptionClicked: { + if(option === 0) + clipboard.setText(address) + } } } } diff --git a/components/TableDropdown.qml b/components/TableDropdown.qml index 17b4bc93..69728a73 100644 --- a/components/TableDropdown.qml +++ b/components/TableDropdown.qml @@ -3,8 +3,9 @@ import QtQuick 2.0 Item { id: dropdown property bool expanded: false + property alias dataModel: repeater.model signal collapsed() - signal optionClicked(int index) + signal optionClicked(int option) width: 72 height: 37 @@ -115,17 +116,8 @@ Item { anchors.right: parent.right anchors.top: parent.top - ListModel { - id: dataModel - ListElement { name: "Add to adress book"; icon: "../images/dropdownOption1.png" } - ListElement { name: "Send to same destination"; icon: "../images/dropdownSend.png" } - ListElement { name: "Find similar transactions"; icon: "../images/dropdownSearch.png" } - } - Repeater { id: repeater - model: dataModel - delegate: Rectangle { id: delegate anchors.left: parent.left @@ -163,7 +155,7 @@ Item { anchors.fill: parent propagateComposedEvents: true onEntered: { - var pos = appWindow.mapFromItem(delegate, 30, -20) + var pos = rootItem.mapFromItem(delegate, 30, -20) tipItem.text = name tipItem.x = pos.x if(tipItem.height > 30) diff --git a/components/TitleBar.qml b/components/TitleBar.qml index 5db8b7e1..c4f2dab5 100644 --- a/components/TitleBar.qml +++ b/components/TitleBar.qml @@ -8,6 +8,15 @@ Rectangle { y: -height property int mouseX: 0 property int mouseY: 0 + + Text { + anchors.centerIn: parent + font.family: "Arial" + font.pixelSize: 15 + font.letterSpacing: -1 + color: "#FFFFFF" + text: qsTr("Monero") + } Behavior on y { NumberAnimation { duration: 100; easing.type: Easing.InQuad } diff --git a/filter.cpp b/filter.cpp index df0b9376..e9b236d6 100644 --- a/filter.cpp +++ b/filter.cpp @@ -25,6 +25,10 @@ bool filter::eventFilter(QObject *obj, QEvent *ev) { QKeySequence ks(ke->modifiers() + ke->key()); sks = ks.toString(); } +#ifndef Q_OS_MAC + if(sks.contains("Alt+Tab") || sks.contains("Alt+Shift+Backtab")) + break; +#endif emit sequencePressed(QVariant::fromValue(obj), sks); } break; case QEvent::KeyRelease: { @@ -39,6 +43,10 @@ bool filter::eventFilter(QObject *obj, QEvent *ev) { QKeySequence ks(ke->modifiers() + ke->key()); sks = ks.toString(); } +#ifndef Q_OS_MAC + if(sks.contains("Alt+Tab") || sks.contains("Alt+Shift+Backtab")) + break; +#endif emit sequenceReleased(QVariant::fromValue(obj), sks); } break; case QEvent::MouseButtonPress: { diff --git a/images/dropdownOption1.png b/images/dropdownAdd.png similarity index 100% rename from images/dropdownOption1.png rename to images/dropdownAdd.png diff --git a/images/dropdownCopy.png b/images/dropdownCopy.png new file mode 100644 index 00000000..24d0d590 Binary files /dev/null and b/images/dropdownCopy.png differ diff --git a/images/moneroLogo.png b/images/moneroLogo.png index 8155c5fa..8cbb60c2 100644 Binary files a/images/moneroLogo.png and b/images/moneroLogo.png differ diff --git a/main.cpp b/main.cpp index b1e66ae8..38776326 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,7 @@ #include #include - +#include +#include "clipboardAdapter.h" #include "filter.h" int main(int argc, char *argv[]) @@ -9,6 +10,8 @@ int main(int argc, char *argv[]) filter *eventFilter = new filter; app.installEventFilter(eventFilter); + qmlRegisterType("moneroComponents", 1, 0, "Clipboard"); + QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); QObject *rootObject = engine.rootObjects().first(); diff --git a/main.qml b/main.qml index e485dde7..8bb2c1f2 100644 --- a/main.qml +++ b/main.qml @@ -11,6 +11,7 @@ ApplicationWindow { property bool whatIsEnable: false property bool ctrlPressed: false property bool rightPanelExpanded: true + property bool osx: false function altKeyReleased() { ctrlPressed = false; } function showPageRequest(page) { @@ -31,14 +32,14 @@ ApplicationWindow { else if(seq === "Ctrl+B") middlePanel.state = "AddressBook" else if(seq === "Ctrl+M") middlePanel.state = "Mining" else if(seq === "Ctrl+S") middlePanel.state = "Settings" - else if(seq === "Ctrl+Tab") { + else if(seq === "Ctrl+Tab" || seq === "Alt+Tab") { if(middlePanel.state === "Dashboard") middlePanel.state = "Transfer" else if(middlePanel.state === "Transfer") middlePanel.state = "History" else if(middlePanel.state === "History") middlePanel.state = "AddressBook" else if(middlePanel.state === "AddressBook") middlePanel.state = "Mining" else if(middlePanel.state === "Mining") middlePanel.state = "Settings" else if(middlePanel.state === "Settings") middlePanel.state = "Dashboard" - } else if(seq === "Ctrl+Shift+Backtab") { + } else if(seq === "Ctrl+Shift+Backtab" || seq === "Alt+Shift+Backtab") { if(middlePanel.state === "Dashboard") middlePanel.state = "Settings" else if(middlePanel.state === "Settings") middlePanel.state = "Mining" else if(middlePanel.state === "Mining") middlePanel.state = "AddressBook" diff --git a/qml.qrc b/qml.qrc index a0a5e571..eae1e0f7 100644 --- a/qml.qrc +++ b/qml.qrc @@ -41,7 +41,7 @@ components/DashboardTable.qml components/TableDropdown.qml images/tableOptions.png - images/dropdownOption1.png + images/dropdownAdd.png images/dropdownSearch.png images/dropdownSend.png components/TipItem.qml @@ -69,5 +69,6 @@ components/TitleBar.qml images/collapseRightPanel.png images/expandRightPanel.png + images/dropdownCopy.png