[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:20:48 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=04f129e
The following commit has been merged in the master branch:
commit 04f129ecbb52d5736fb5c606aca773eaefd05f22
Author: Lasath Fernando <kde at lasath.org>
Date: Mon Dec 5 19:34:54 2011 +1100
UI improvements
---
lib/chat-widget.cpp | 7 +
lib/chat-widget.h | 3 -
lib/conversation-target.cpp | 38 ++++-
lib/conversation-target.h | 16 +-
lib/conversation.h | 6 +-
lib/conversations-model.h | 4 +-
lib/messages-model.cpp | 3 +-
lib/messages-model.h | 4 +-
lib/telepathy-text-observer.h | 5 +-
plasmoid/contents/ui/ChatWidget.qml | 202 +++++++++++++++++---------
plasmoid/contents/ui/ConversationDelegate.qml | 96 ++++++++++++
plasmoid/contents/ui/TextDelegate.qml | 13 +-
plasmoid/contents/ui/main.qml | 72 ++++-----
plasmoid/metadata.desktop | 2 +-
14 files changed, 343 insertions(+), 128 deletions(-)
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 5494b7a..2cdf01d 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -855,6 +855,13 @@ void ChatWidget::onFormatColorReleased()
d->ui.sendMessageBox->setTextColor(color);
}
+
+KIcon ChatWidget::iconForPresence(Tp::ConnectionPresenceType presence)
+{
+
+ return KIcon(iconSourceForPresence(presence));
+}
+
bool ChatWidget::isUserTyping() const
{
return d->remoteContactIsTyping;
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index c6015dd..30afa31 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -85,9 +85,6 @@ public:
QString spellDictionary() const;
void setSpellDictionary(const QString &dict);
- //FIXME this should be in the ktelepathy lib
- static KIcon iconForPresence(Tp::ConnectionPresenceType presence);
-
public Q_SLOTS:
/** toggle the search bar visibility */
diff --git a/lib/conversation-target.cpp b/lib/conversation-target.cpp
index c2bc701..7b9e554 100644
--- a/lib/conversation-target.cpp
+++ b/lib/conversation-target.cpp
@@ -50,6 +50,7 @@ void ConversationTarget::setupContactSignals(Tp::ContactPtr contact)
QIcon ConversationTarget::avatar() const
{
+ //FIXME: return KIcon("im-user") if avatar is unavailable
return QIcon(d->contact->avatarData().fileName);
}
@@ -60,11 +61,46 @@ QString ConversationTarget::nick() const
QIcon ConversationTarget::presenceIcon() const
{
- return ChatWidget::iconForPresence(d->contact->presence().type());
+ return KIcon(presenceIconSource());
}
+QString ConversationTarget::presenceIconSource() const
+{
+ return iconSourceForPresence(d->contact->presence().type());
+}
+
+QString ConversationTarget::iconSourceForPresence(Tp::ConnectionPresenceType presence)
+{
+ QString iconName;
+
+ switch (presence) {
+ case Tp::ConnectionPresenceTypeAvailable:
+ iconName = QLatin1String("user-online");
+ break;
+ case Tp::ConnectionPresenceTypeAway:
+ iconName = QLatin1String("user-away");
+ break;
+ case Tp::ConnectionPresenceTypeExtendedAway:
+ iconName = QLatin1String("user-away-extended");
+ break;
+ case Tp::ConnectionPresenceTypeHidden:
+ iconName = QLatin1String("user-invisible");
+ break;
+ case Tp::ConnectionPresenceTypeBusy:
+ iconName = QLatin1String("user-busy");
+ break;
+ default:
+ iconName = QLatin1String("user-offline");
+ break;
+ }
+
+ return iconName;
+}
+
+
void ConversationTarget::onPresenceChanged(Tp::Presence)
{
+ Q_EMIT presenceIconSourceChanged(presenceIconSource());
Q_EMIT presenceIconChanged(presenceIcon());
}
diff --git a/lib/conversation-target.h b/lib/conversation-target.h
index dbfdec2..4af5a47 100644
--- a/lib/conversation-target.h
+++ b/lib/conversation-target.h
@@ -21,10 +21,12 @@
#define CONVERSATION_TARGET_H
#include <QObject>
-#include <TelepathyQt4/Contact>
+#include <TelepathyQt/Contact>
#include "chat-widget.h"
-#include "kdetelepathychat_export.h"
+
+#include "ktpchat_export.h"
+
class KDE_TELEPATHY_CHAT_EXPORT ConversationTarget : public QObject
{
@@ -33,6 +35,7 @@ Q_OBJECT
Q_PROPERTY(QIcon avatar READ avatar NOTIFY avatarChanged);
Q_PROPERTY(QString nick READ nick NOTIFY nickChanged);
Q_PROPERTY(QIcon presenceIcon READ presenceIcon NOTIFY presenceIconChanged);
+Q_PROPERTY(QString presenceIconSource READ presenceIconSource NOTIFY presenceIconSourceChanged);
//turns out you can't have non QObjects as properties
// Q_PROPERTY(Tp::ContactPtr contact READ contact WRITE setContact NOTIFY contactChanged);
@@ -41,17 +44,22 @@ public:
ConversationTarget( Tp::ContactPtr contact = Tp::ContactPtr());
virtual ~ConversationTarget();
- QIcon avatar() const;
+ QIcon avatar() const;
QString nick() const;
- QIcon presenceIcon() const;
+ QIcon presenceIcon() const;
+ QString presenceIconSource() const;
Tp::ContactPtr contact() const;
void setContact(Tp::ContactPtr contact);
+
+ static QString iconSourceForPresence(Tp::ConnectionPresenceType presence);
+
Q_SIGNALS:
void avatarChanged(QIcon avatar);
void nickChanged(QString nick);
void presenceIconChanged(QIcon icon);
+ void presenceIconSourceChanged(QString source);
void contactChanged(Tp::ContactPtr contact);
diff --git a/lib/conversation.h b/lib/conversation.h
index 439150b..65e77bc 100644
--- a/lib/conversation.h
+++ b/lib/conversation.h
@@ -20,11 +20,11 @@
#ifndef CONVERSATION_H
#define CONVERSATION_H
-#include "kdetelepathychat_export.h"
+#include "ktpchat_export.h"
#include <QObject>
-#include <TelepathyQt4/Account>
-#include <TelepathyQt4/TextChannel>
+#include <TelepathyQt/Account>
+#include <TelepathyQt/TextChannel>
// #include "conversation-model.h"
#include <KIcon>
#include "conversation-target.h"
diff --git a/lib/conversations-model.h b/lib/conversations-model.h
index c56cee7..4af433c 100644
--- a/lib/conversations-model.h
+++ b/lib/conversations-model.h
@@ -21,7 +21,9 @@
#define CONVERSATIONS_MODEL_H
#include <QAbstractListModel>
-#include "kdetelepathychat_export.h"
+
+#include "ktpchat_export.h"
+
class Conversation;
diff --git a/lib/messages-model.cpp b/lib/messages-model.cpp
index 989752e..bc85936 100644
--- a/lib/messages-model.cpp
+++ b/lib/messages-model.cpp
@@ -88,7 +88,8 @@ void MessagesModel::setTextChannel(Tp::TextChannelPtr channel)
if(d->textChannel) {
removeChannelSignals(channel);
}
- d->textChannel = channel; //FIXME: check if channel is valid
+ //FIXME: check messageQue for any lost messages
+ d->textChannel = channel;
textChannelChanged(channel);
}
diff --git a/lib/messages-model.h b/lib/messages-model.h
index 720ee1f..6ce698a 100644
--- a/lib/messages-model.h
+++ b/lib/messages-model.h
@@ -20,10 +20,10 @@
#ifndef MESSAGES_MODEL_H
#define MESSAGES_MODEL_H
-#include "kdetelepathychat_export.h"
+#include "ktpchat_export.h"
#include <QAbstractItemModel>
-#include <TelepathyQt4/TextChannel>
+#include <TelepathyQt/TextChannel>
class KDE_TELEPATHY_CHAT_EXPORT MessagesModel : public QAbstractListModel
diff --git a/lib/telepathy-text-observer.h b/lib/telepathy-text-observer.h
index dcec492..9025081 100644
--- a/lib/telepathy-text-observer.h
+++ b/lib/telepathy-text-observer.h
@@ -20,8 +20,9 @@
#ifndef TELEPATHY_TEXT_OBSERVER_H
#define TELEPATHY_TEXT_OBSERVER_H
-#include "kdetelepathychat_export.h"
-#include <TelepathyQt4/AbstractClient>
+#include "ktpchat_export.h"
+
+#include <TelepathyQt/AbstractClient>
class Conversation;
diff --git a/plasmoid/contents/ui/ChatWidget.qml b/plasmoid/contents/ui/ChatWidget.qml
index d966f32..af1dc4e 100644
--- a/plasmoid/contents/ui/ChatWidget.qml
+++ b/plasmoid/contents/ui/ChatWidget.qml
@@ -2,98 +2,158 @@ import Qt 4.7
import org.kde.telepathy.declarativeplugins 0.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
+import org.kde.plasma.components 0.1 as PlasmaComponents
-/*PlasmaCore.Dialog {
- id:main
+Item {
+ property Conversation conv
- function derp() {
- console.log("deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerp!");
- return true;
- }
+ signal closeRequested
+ signal conversationEndRequested
+ Item {
+ id: titleArea
+ anchors {
+ margins: 5
+ top: parent.top
+ left: parent.left; right: parent.right
+ }
+ height: 24
- mainItem: */
-Item {
- property Conversation conv
+ PlasmaComponents.ToolButton {
+ id: contactButton
+
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: closeButton.left
+ bottom: parent.bottom
+ }
- PlasmaWidgets.IconWidget {
- id: title
text: conv.target.nick
- icon: conv.target.avatar
- anchors.top: parent.top
- anchors.left: parent.left; anchors.right: parent.right
- // anchors.bottom: chatArea.top
- height: 12
- orientation: Qt.Horizontal
+ iconSource: conv.target.presenceIconSource
+
+ onClicked: closeRequested()
+ }
+
+ PlasmaComponents.ToolButton {
+ id: closeButton
+
+ anchors {
+ top: parent.top
+ right: parent.right
+ bottom: parent.bottom
+ }
+
+ iconSource: "dialog-close"
+
+ onClicked: conversationEndRequested()
+ }
+ }
+
+ PlasmaWidgets.Separator {
+ id: space
+ anchors {
+ top: titleArea.bottom
+ left: parent.left
+ right: parent.right
}
+ orientation: Qt.Horizontal
+ }
+
+
+ Item {
+ id:chatArea
- Item {
- id:chatArea
+ anchors.top: space.bottom
+ anchors.left: parent.left; anchors.right: parent.right
+ anchors.bottom: input.top
+ anchors.margins: 5
- // anchors.top: parent.top
- anchors.top: title.bottom
- anchors.left: parent.left; anchors.right: parent.right
- anchors.bottom: input.top
- anchors.margins: 5
+// PlasmaComponents.Highlight { anchors.fill: chatArea }
- Rectangle {
- anchors.fill: chatArea
+ ListView {
+ id: view
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ left: parent.left
+ right: viewScrollBar.left
}
+ boundsBehavior: Flickable.StopAtBounds
+ clip: true
- ListView {
- id: view
+ delegate: TextDelegate {}
+ model: conv.model
+ }
- anchors.fill: parent
- clip: true
+ PlasmaComponents.ScrollBar {
+ id: viewScrollBar
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ right: parent.right
+ }
- delegate: TextDelegate {}
- model: conv.model
- ListView.onAdd: {
- derp();
+ flickableItem: view
+ width: 16
+ opacity: 1
+ orientation: Qt.Vertical
+ }
+
+
+ //used states here to make the scroll bar (dis)appear
+ states: [
+ State {
+ name: "auto-scrolling"
+ when: view.atYEnd
+ PropertyChanges {
+ target: view.model
+ restoreEntryValues: true
+ onRowsInserted: {
+ view.positionViewAtEnd();
+ }
+ }
+ PropertyChanges {
+ target: viewScrollBar
+ restoreEntryValues: true
+ width: 0
+ opacity: 0
}
}
+ ]
- //used states here because it'll make a scrollbar (dis)appear later on
- states: [
- State {
- name: "static"
- },
- State {
- name: "auto-scrolling"
- PropertyChanges {
- target: view.model
- restoreEntryValues: true
- onRowsInserted: {
- view.positionViewAtEnd();
- }
- }
+ transitions: [
+ Transition {
+ from: "*"
+ to: "auto-scrolling"
+
+ PropertyAnimation {
+ properties: "width,opacity"
+ duration: 250
}
- ]
+ },
+ Transition {
+ from: "auto-scrolling"
+ to: "*"
+
+ PropertyAnimation {
+ properties: "width,opacity"
+ duration: 250
+ }
+ }
+ ]
+ }
- }
+ PlasmaWidgets.LineEdit {
+ id: input
- PlasmaWidgets.LineEdit {
- id: input
- // anchors.top: view.bottom
- anchors.left: parent.left; anchors.right: parent.right
- anchors.bottom: parent.bottom
+ anchors.left: parent.left; anchors.right: parent.right
+ anchors.bottom: parent.bottom
- onReturnPressed: {
- view.model.sendNewMessage(text);
- text = "";
- }
+ onReturnPressed: {
+ view.model.sendNewMessage(text);
+ text = "";
}
}
-
-// ConversationWatcher {
-// id:watcher
-// onNewConversation: {
-// console.log("New Convo!");
-// conv = con;
-// // conv.model = con.model;
-// // view.model.rowsInserted.connect(view.positionViewAtEnd);
-// chatArea.state = "auto-scrolling";
-// }
-// }
-// }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/plasmoid/contents/ui/ConversationDelegate.qml b/plasmoid/contents/ui/ConversationDelegate.qml
new file mode 100644
index 0000000..6ddffeb
--- /dev/null
+++ b/plasmoid/contents/ui/ConversationDelegate.qml
@@ -0,0 +1,96 @@
+import Qt 4.7
+import org.kde.telepathy.declarativeplugins 0.1
+import org.kde.plasma.core 0.1 as PlasmaCore
+import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
+import org.kde.plasma.components 0.1 as PlasmaComponents
+
+Item {
+ PlasmaCore.FrameSvgItem {
+ id: canvas
+
+ prefix: "normal"
+ imagePath: "widgets/tasks"
+ opacity: 1
+ anchors.fill: parent
+// anchors.margins: 5
+ }
+// height: icon.height + 10
+ width: icon.width + 10
+
+ PlasmaCore.Dialog {
+ id: dialog
+ windowFlags: Qt.Dialog
+ mainItem: ChatWidget {
+ width: 250
+ height: 350
+ conv: model.conversation
+
+ onCloseRequested: mouse.popupApplet()
+ }
+ }
+
+ //ise listitem?
+ PlasmaWidgets.IconWidget {
+ id: icon
+// text: model.conversation.target.nick
+ icon: model.conversation.target.presenceIcon
+// anchors {
+// top: parent.top
+// left: parent.left
+// }
+ anchors.fill: parent
+ anchors.margins: 5
+
+// size: "32x32"
+ size: {
+ console.log("height = " + parent.height);
+ console.log("width = " + parent.width);
+ return Qt.size(parent.height, parent.height);
+ }
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+
+ hoverEnabled: true
+
+ //move le onClicked into main
+ onClicked: popupApplet()
+ function popupApplet() {
+ if(dialog.visible == false) {
+ var point = dialog.popupPosition(icon, Qt.AlignBottom);
+ console.log("Showing dialog at (" + point.x + "," + point.y + ")");
+
+ dialog.x = point.x;
+ dialog.y = point.y;
+
+ dialog.visible = true;
+ } else {
+ console.log("height = " + dialog.height);
+ console.log("width = " + dialog.width);
+ dialog.visible = false;
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "focus"
+ //use property instead
+ when: dialog.visible
+ PropertyChanges {
+ target: canvas
+ prefix: "focus"
+ }
+ },
+ State {
+ name: "hover"
+ when: mouse.containsMouse
+ PropertyChanges {
+ target: canvas
+ prefix: "hover"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/plasmoid/contents/ui/TextDelegate.qml b/plasmoid/contents/ui/TextDelegate.qml
index 845eb59..2b64707 100644
--- a/plasmoid/contents/ui/TextDelegate.qml
+++ b/plasmoid/contents/ui/TextDelegate.qml
@@ -1,20 +1,27 @@
import Qt 4.7
+import org.kde.plasma.components 0.1 as PlasmaComponents
+import org.kde.plasma.core 0.1 as PlasmaCore
Item {
- Text {
+ property color textColor: theme.textColor
+
+ PlasmaComponents.Label {
id: header
+
width: view.width
wrapMode: Text.Wrap
+ color: textColor
text: "[" + Qt.formatTime(model.time) + "] " + model.user + " :"
}
- Text {
+ PlasmaComponents.Label {
id: body
anchors.top: header.bottom
width: view.width
-
wrapMode: Text.Wrap
+
+ color: textColor
text: model.text
}
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index 560e187..fa2982d 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -2,51 +2,51 @@ import Qt 4.7
import org.kde.telepathy.declarativeplugins 0.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
+import org.kde.plasma.components 0.1 as PlasmaComponents
+// import "createDialog.js" as MyScript
Item {
+// PlasmaCore.SvgItem {
+// elementId: "horizzontal-line"
+// anchors.fill:parent
+// svg: PlasmaCore.Svg {
+// id: mySvg
+// imagePath: "widgets/line"
+// }
+// }
+
+// PlasmaCore.FrameSvgItem {
+// id: surface
+//
+// anchors.fill: parent
+// // prefix: (internal.userPressed || checked) ? "pressed" : "normal"
+// //internal: if there is no hover status, don't paint on mouse over in touchscreens
+// // opacity: (internal.userPressed || checked || !flat || (shadow.hasOverState && mouse.containsMouse)) ? 1 : 0
+// // Behavior on opacity {
+// // PropertyAnimation { duration: 100 }
+// // }
+// }
+// PlasmaComponents.ListItem {
+// anchors.fill: parent
+// enabled: true
+// sectionDelegate: true
+// }
ListView {
id: base
anchors.fill: parent
orientation: Qt.Horizontal
- model: convos
- delegate : Item {
-// PlasmaWidgets.SvgWidget {
-// elementID: "widgets/frame.svg"
-// anchors.fill: parent
-// }
- PlasmaWidgets.IconWidget {
- id: icon
- text: model.conversation.target.nick
- icon: model.conversation.target.presenceIcon
- anchors.fill: parent
-
-// Component {
-// id: chatComp
-
-// }
- property Component popout: PlasmaCore.Dialog {
- mainItem: ChatWidget {
- width: 200
- height: 400
- conv: model.conversation
- }
- }
+ model: ConversationsModel {
+ }
- onClicked: {
- var dialog = popout.createObject(base, {});
- console.log(dialog);
- var point = dialog.popupPosition(icon, Qt.AlignTop);
- console.log("Showing dialog at (" + point.x + "," + point.y + ")");
- dialog.x = point.x;
- dialog.y = point.y;
- dialog.animatedShow(PlasmaCore.Up);
- }
- }
+ delegate : ConversationDelegate {
+ anchors.top: parent.top
+// height: 60
+ anchors.bottom: parent.bottom
+// anchors.margins: 5
}
}
- ConversationsModel {
- id: convos
- }
+// height: parent.height
+// width: 60
}
\ No newline at end of file
diff --git a/plasmoid/metadata.desktop b/plasmoid/metadata.desktop
index 6b0c002..75d4f67 100644
--- a/plasmoid/metadata.desktop
+++ b/plasmoid/metadata.desktop
@@ -5,7 +5,7 @@ Icon=kde-telepathy
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
-X-Plasma-DefaultSize=300,200
+X-Plasma-DefaultSize=300,48
# X-Plasma-RequiredExtensions=LaunchApp
X-KDE-PluginInfo-Author=Frederik Gladhorn
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list