marcin 2014-07-16 14:40:09 +02:00
parent 855d5736c5
commit 2eddebe1c2
15 changed files with 98 additions and 27 deletions

View file

@ -34,15 +34,15 @@ Rectangle {
Image { Image {
id: logo id: logo
anchors.horizontalCenter: parent.horizontalCenter anchors.left: parent.left
anchors.leftMargin: 50
source: "images/moneroLogo.png" source: "images/moneroLogo.png"
} }
Image { Image {
anchors.right: logo.left anchors.left: parent.left
anchors.verticalCenter: logo.verticalCenter anchors.verticalCenter: logo.verticalCenter
anchors.verticalCenterOffset: 5 anchors.leftMargin: 19
anchors.rightMargin: 20
source: appWindow.rightPanelExpanded ? "images/expandRightPanel.png" : source: appWindow.rightPanelExpanded ? "images/expandRightPanel.png" :
"images/collapseRightPanel.png" "images/collapseRightPanel.png"
} }

View file

@ -3,7 +3,8 @@ TEMPLATE = app
QT += qml quick widgets QT += qml quick widgets
SOURCES += main.cpp \ SOURCES += main.cpp \
filter.cpp filter.cpp \
clipboardAdapter.cpp
RESOURCES += qml.qrc RESOURCES += qml.qrc
@ -14,4 +15,5 @@ QML_IMPORT_PATH =
include(deployment.pri) include(deployment.pri)
HEADERS += \ HEADERS += \
filter.h filter.h \
clipboardAdapter.h

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.1.2, 2014-07-16T10:51:34. --> <!-- Written by QtCreator 3.1.2, 2014-07-16T14:38:55. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>

12
clipboardAdapter.cpp Normal file
View file

@ -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);
}

19
clipboardAdapter.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef CLIPBOARDADAPTER_H
#define CLIPBOARDADAPTER_H
#include <QGuiApplication>
#include <QClipboard>
#include <QObject>
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

View file

@ -1,5 +1,6 @@
import QtQuick 2.0 import QtQuick 2.0
import "../components" import "../components"
import moneroComponents 1.0
ListView { ListView {
id: listView id: listView
@ -36,30 +37,39 @@ ListView {
} }
Text { Text {
id: paymentIdText id: descriptionText
width: text.length ? 120 : 0 width: text.length ? (descriptionArea.containsMouse ? parent.width - x - 12 : 120) : 0
anchors.verticalCenter: dot.verticalCenter anchors.verticalCenter: dot.verticalCenter
font.family: "Arial" font.family: "Arial"
font.bold: true font.bold: true
font.pixelSize: 19 font.pixelSize: 19
color: "#444444" color: "#444444"
elide: Text.ElideRight elide: Text.ElideRight
text: paymentId text: description
MouseArea {
id: descriptionArea
anchors.fill: parent
hoverEnabled: true
}
} }
Item { //separator Item { //separator
width: paymentIdText.width ? 12 : 0 width: descriptionText.width ? 12 : 0
height: 14 height: 14
visible: !descriptionArea.containsMouse
} }
Text { Text {
id: addressText
anchors.verticalCenter: dot.verticalCenter anchors.verticalCenter: dot.verticalCenter
width: parent.width - x - 12 width: parent.width - x - 12
elide: Text.ElideRight elide: Text.ElideRight
font.family: "Arial" font.family: "Arial"
font.pixelSize: 14 font.pixelSize: 14
color: "#545454" color: "#545454"
text: description.length > 0 ? description : address text: address
visible: !descriptionArea.containsMouse
} }
} }
@ -173,12 +183,22 @@ ListView {
color: "#DBDBDB" color: "#DBDBDB"
} }
ListModel {
id: dropModel
ListElement { name: "<b>Copy address to clipboard</b>"; icon: "../images/dropdownCopy.png" }
ListElement { name: "<b>Add to address book</b>"; icon: "../images/dropdownAdd.png" }
ListElement { name: "<b>Send to same destination</b>"; icon: "../images/dropdownSend.png" }
ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
}
Clipboard { id: clipboard }
TableDropdown { TableDropdown {
id: dropdown id: dropdown
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 11 anchors.bottomMargin: 11
anchors.rightMargin: 5 anchors.rightMargin: 5
dataModel: dropModel
onExpandedChanged: { onExpandedChanged: {
if(listView.previousItem !== undefined && listView.previousItem !== delegate) if(listView.previousItem !== undefined && listView.previousItem !== delegate)
listView.previousItem.collapseDropdown() listView.previousItem.collapseDropdown()
@ -189,6 +209,10 @@ ListView {
} }
} }
onCollapsed: delegate.z = 0 onCollapsed: delegate.z = 0
onOptionClicked: {
if(option === 0)
clipboard.setText(address)
}
} }
} }
} }

View file

@ -3,8 +3,9 @@ import QtQuick 2.0
Item { Item {
id: dropdown id: dropdown
property bool expanded: false property bool expanded: false
property alias dataModel: repeater.model
signal collapsed() signal collapsed()
signal optionClicked(int index) signal optionClicked(int option)
width: 72 width: 72
height: 37 height: 37
@ -115,17 +116,8 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
ListModel {
id: dataModel
ListElement { name: "<b>Add to adress book</b>"; icon: "../images/dropdownOption1.png" }
ListElement { name: "<b>Send to same destination</b>"; icon: "../images/dropdownSend.png" }
ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
}
Repeater { Repeater {
id: repeater id: repeater
model: dataModel
delegate: Rectangle { delegate: Rectangle {
id: delegate id: delegate
anchors.left: parent.left anchors.left: parent.left
@ -163,7 +155,7 @@ Item {
anchors.fill: parent anchors.fill: parent
propagateComposedEvents: true propagateComposedEvents: true
onEntered: { onEntered: {
var pos = appWindow.mapFromItem(delegate, 30, -20) var pos = rootItem.mapFromItem(delegate, 30, -20)
tipItem.text = name tipItem.text = name
tipItem.x = pos.x tipItem.x = pos.x
if(tipItem.height > 30) if(tipItem.height > 30)

View file

@ -8,6 +8,15 @@ Rectangle {
y: -height y: -height
property int mouseX: 0 property int mouseX: 0
property int mouseY: 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 { Behavior on y {
NumberAnimation { duration: 100; easing.type: Easing.InQuad } NumberAnimation { duration: 100; easing.type: Easing.InQuad }

View file

@ -25,6 +25,10 @@ bool filter::eventFilter(QObject *obj, QEvent *ev) {
QKeySequence ks(ke->modifiers() + ke->key()); QKeySequence ks(ke->modifiers() + ke->key());
sks = ks.toString(); sks = ks.toString();
} }
#ifndef Q_OS_MAC
if(sks.contains("Alt+Tab") || sks.contains("Alt+Shift+Backtab"))
break;
#endif
emit sequencePressed(QVariant::fromValue<QObject*>(obj), sks); emit sequencePressed(QVariant::fromValue<QObject*>(obj), sks);
} break; } break;
case QEvent::KeyRelease: { case QEvent::KeyRelease: {
@ -39,6 +43,10 @@ bool filter::eventFilter(QObject *obj, QEvent *ev) {
QKeySequence ks(ke->modifiers() + ke->key()); QKeySequence ks(ke->modifiers() + ke->key());
sks = ks.toString(); sks = ks.toString();
} }
#ifndef Q_OS_MAC
if(sks.contains("Alt+Tab") || sks.contains("Alt+Shift+Backtab"))
break;
#endif
emit sequenceReleased(QVariant::fromValue<QObject*>(obj), sks); emit sequenceReleased(QVariant::fromValue<QObject*>(obj), sks);
} break; } break;
case QEvent::MouseButtonPress: { case QEvent::MouseButtonPress: {

View file

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 384 B

BIN
images/dropdownCopy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -1,6 +1,7 @@
#include <QApplication> #include <QApplication>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QtQml>
#include "clipboardAdapter.h"
#include "filter.h" #include "filter.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -9,6 +10,8 @@ int main(int argc, char *argv[])
filter *eventFilter = new filter; filter *eventFilter = new filter;
app.installEventFilter(eventFilter); app.installEventFilter(eventFilter);
qmlRegisterType<clipboardAdapter>("moneroComponents", 1, 0, "Clipboard");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
QObject *rootObject = engine.rootObjects().first(); QObject *rootObject = engine.rootObjects().first();

View file

@ -11,6 +11,7 @@ ApplicationWindow {
property bool whatIsEnable: false property bool whatIsEnable: false
property bool ctrlPressed: false property bool ctrlPressed: false
property bool rightPanelExpanded: true property bool rightPanelExpanded: true
property bool osx: false
function altKeyReleased() { ctrlPressed = false; } function altKeyReleased() { ctrlPressed = false; }
function showPageRequest(page) { function showPageRequest(page) {
@ -31,14 +32,14 @@ ApplicationWindow {
else if(seq === "Ctrl+B") middlePanel.state = "AddressBook" else if(seq === "Ctrl+B") middlePanel.state = "AddressBook"
else if(seq === "Ctrl+M") middlePanel.state = "Mining" else if(seq === "Ctrl+M") middlePanel.state = "Mining"
else if(seq === "Ctrl+S") middlePanel.state = "Settings" 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" if(middlePanel.state === "Dashboard") middlePanel.state = "Transfer"
else if(middlePanel.state === "Transfer") middlePanel.state = "History" else if(middlePanel.state === "Transfer") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "AddressBook" else if(middlePanel.state === "History") middlePanel.state = "AddressBook"
else if(middlePanel.state === "AddressBook") middlePanel.state = "Mining" else if(middlePanel.state === "AddressBook") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "Settings" else if(middlePanel.state === "Mining") middlePanel.state = "Settings"
else if(middlePanel.state === "Settings") middlePanel.state = "Dashboard" 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" if(middlePanel.state === "Dashboard") middlePanel.state = "Settings"
else if(middlePanel.state === "Settings") middlePanel.state = "Mining" else if(middlePanel.state === "Settings") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "AddressBook" else if(middlePanel.state === "Mining") middlePanel.state = "AddressBook"

View file

@ -41,7 +41,7 @@
<file>components/DashboardTable.qml</file> <file>components/DashboardTable.qml</file>
<file>components/TableDropdown.qml</file> <file>components/TableDropdown.qml</file>
<file>images/tableOptions.png</file> <file>images/tableOptions.png</file>
<file>images/dropdownOption1.png</file> <file>images/dropdownAdd.png</file>
<file>images/dropdownSearch.png</file> <file>images/dropdownSearch.png</file>
<file>images/dropdownSend.png</file> <file>images/dropdownSend.png</file>
<file>components/TipItem.qml</file> <file>components/TipItem.qml</file>
@ -69,5 +69,6 @@
<file>components/TitleBar.qml</file> <file>components/TitleBar.qml</file>
<file>images/collapseRightPanel.png</file> <file>images/collapseRightPanel.png</file>
<file>images/expandRightPanel.png</file> <file>images/expandRightPanel.png</file>
<file>images/dropdownCopy.png</file>
</qresource> </qresource>
</RCC> </RCC>