Skip to content

Commit

Permalink
desktop UI: added QueryDialog + some wireup
Browse files Browse the repository at this point in the history
  • Loading branch information
Venemo committed Jan 5, 2013
1 parent 5c32885 commit 0b13ae6
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 15 deletions.
4 changes: 3 additions & 1 deletion irc-chatter.pro
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ OTHER_FILES += \
qml/desktop/components/Dialog.qml \
qml/desktop/components/Menu.qml \
qml/desktop/components/MenuButton.qml \
qml/desktop/dialogs/ServerSettingsDialog.qml
qml/desktop/dialogs/ServerSettingsDialog.qml \
qml/desktop/dialogs/AboutDialog.qml \
qml/desktop/components/QueryDialog.qml

# User interface for MeeGo
OTHER_FILES += \
Expand Down
4 changes: 4 additions & 0 deletions qml/desktop/AppWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import QtQuick 2.0
import "./components"
import "./pages"
import "./dialogs"

Rectangle {
id: appWindow
Expand All @@ -30,4 +31,7 @@ Rectangle {
id: chatPage
visible: false
}
AboutDialog {
id: aboutDialog
}
}
3 changes: 3 additions & 0 deletions qml/desktop/components/Dialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Rectangle {
visible = true;
showHideAnimation.start();
}
function close() {
showHideAnimation.start();
}

onAccepted: {
showHideAnimation.start();
Expand Down
49 changes: 49 additions & 0 deletions qml/desktop/components/QueryDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// This file is part of IRC Chatter, the first IRC Client for MeeGo.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Copyright (C) 2012, Timur Kristóf <[email protected]>

import QtQuick 2.0
import "../components"

Dialog {
id: queryDialog

property alias text: theText.text
property alias textFormat: theText.textFormat

title: "Are you sure?"
acceptButtonText: "Yes"
rejectButtonText: "No"
gradient: Gradient {
GradientStop { position: 0.0; color: "#cc222222" }
GradientStop { position: 0.4; color: "#dd444444" }
}

Text {
id: theText
width: parent.width * 0.5
wrapMode: Text.Wrap
color: "#fff"
onLinkActivated: {
if (link == "back://back") {
queryDialog.close();
}
else {
Qt.openUrlExternally(link);
}
}
}
}
15 changes: 5 additions & 10 deletions qml/desktop/misc/ChannelSwitcherButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ Button {
color: "#fff"
visible: !isConnected && !isConnecting
}
MenuButton {
text: "View topic"
visible: isChannel && isConnected
// TODO: onClicked
}
MenuButton {
text: "User list (138)"
visible: isChannel && isConnected
Expand All @@ -147,11 +142,6 @@ Button {
visible: isChannel && isConnected
// TODO: onClicked
}
MenuButton {
text: "View whois"
visible: isQuery && isConnected
// TODO: onClicked
}
MenuButton {
text: "Close"
visible: isQuery && isConnected
Expand All @@ -167,6 +157,11 @@ Button {
visible: isServer && !isConnected && !isConnecting
// TODO: onClicked
}
MenuButton {
text: "Join / query"
visible: isServer && isConnected
// TODO: onClicked
}
}
}
}
16 changes: 12 additions & 4 deletions qml/desktop/pages/ChatPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ Page {
MenuButton {
text: "Disconnect all"
onClicked: {
// TODO: confirmation dialog
// TODO: actual disconnecting
startPage.animateIn();
chatPage.animateOut();
areYouSureToDisconnectAllDialog.open();
}
}
MenuButton {
Expand Down Expand Up @@ -249,4 +246,15 @@ Page {
}
}
}

// Dialog for disconnecting from all servers
QueryDialog {
id: areYouSureToDisconnectAllDialog
text: "Do you want to disconnect from all servers?"
onAccepted: {
ircModel.disconnectFromServers();
startPage.animateIn();
chatPage.animateOut();
}
}
}
1 change: 1 addition & 0 deletions ui-desktop.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
<file>qml/desktop/components/Dialog.qml</file>
<file>qml/desktop/dialogs/ServerSettingsDialog.qml</file>
<file>qml/desktop/dialogs/AboutDialog.qml</file>
<file>qml/desktop/components/QueryDialog.qml</file>
</qresource>
</RCC>

0 comments on commit 0b13ae6

Please sign in to comment.