[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:16:12 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=4720201
The following commit has been merged in the master branch:
commit 4720201f1118957c11b19cbe9007d1d3d639df20
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Tue Aug 17 22:39:55 2010 +0000
Support multiuser (room) chat
library supports configuring of theme/variant in the chat view
Updated the configuration tool to preview the chat view settings, saves to a telepathy configuration file.
This part was done by domme.
svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1164902
---
app/KDEChatHandler.client | 4 +++
app/mainwindow.cpp | 12 +++++++
config/chatwindowconfig.ui | 19 +++++-----
config/mainwindow.cpp | 89 ++++++++++++++++++++++++++++++++++++++++------
config/mainwindow.h | 9 +++--
lib/chatconnection.cpp | 3 +-
lib/chatview.cpp | 48 ++++++++++++++++++++++---
lib/chatview.h | 16 +++++++++
lib/chatwindow.cpp | 10 +++++-
lib/chatwindow.h | 5 +++
10 files changed, 186 insertions(+), 29 deletions(-)
diff --git a/app/KDEChatHandler.client b/app/KDEChatHandler.client
index 7918139..cb2dec8 100644
--- a/app/KDEChatHandler.client
+++ b/app/KDEChatHandler.client
@@ -4,3 +4,7 @@ Interfaces=org.freedesktop.Telepathy.Client.Handler;org.freedesktop.Telepathy.Cl
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.Text
org.freedesktop.Telepathy.Channel.TargetHandleType u=1
+
+[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
+org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.Text
+org.freedesktop.Telepathy.Channel.TargetHandleType u=2
\ No newline at end of file
diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index 01583ad..6e30673 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -24,9 +24,21 @@ inline ChannelClassList channelClassList()
{
ChannelClassList filters;
QMap<QString, QDBusVariant> filter;
+
+ filter.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"),
+ QDBusVariant(TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT));
+ filter.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"),
+ QDBusVariant((uint) Tp::HandleTypeContact));
+ filters.append(filter);
+
+ filter.clear();
filter.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"),
QDBusVariant(TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT));
+ filter.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"),
+ QDBusVariant((uint) Tp::HandleTypeRoom));
filters.append(filter);
+
+
return filters;
}
diff --git a/config/chatwindowconfig.ui b/config/chatwindowconfig.ui
index 29d4303..b852a13 100644
--- a/config/chatwindowconfig.ui
+++ b/config/chatwindowconfig.ui
@@ -29,7 +29,7 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
- <widget class="KComboBox" name="kcombobox"/>
+ <widget class="KComboBox" name="styleComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
@@ -40,12 +40,12 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
- <cstring>kcombobox</cstring>
+ <cstring>styleComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="KComboBox" name="kcombobox_2"/>
+ <widget class="KComboBox" name="variantComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
@@ -56,7 +56,7 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
- <cstring>kcombobox_2</cstring>
+ <cstring>variantComboBox</cstring>
</property>
</widget>
</item>
@@ -85,11 +85,7 @@
</widget>
</item>
<item row="4" column="1">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>FIXME, KForntRequester Here</string>
- </property>
- </widget>
+ <widget class="KFontComboBox" name="kfontcombobox"/>
</item>
</layout>
</item>
@@ -135,6 +131,11 @@
</widget>
<customwidgets>
<customwidget>
+ <class>KFontComboBox</class>
+ <extends>KComboBox</extends>
+ <header>kfontcombobox.h</header>
+ </customwidget>
+ <customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
diff --git a/config/mainwindow.cpp b/config/mainwindow.cpp
index 856d2cf..6d9afb2 100644
--- a/config/mainwindow.cpp
+++ b/config/mainwindow.cpp
@@ -6,6 +6,7 @@
#include "telepathychatmessageinfo.h"
#include <QDebug>
+#include <KDebug>
MainWindow::MainWindow(QWidget *parent) :
QDialog(parent),
@@ -15,7 +16,7 @@ MainWindow::MainWindow(QWidget *parent) :
ChatWindowStyleManager* manager = ChatWindowStyleManager::self();
manager->loadStyles();
- connect(manager, SIGNAL(loadStylesFinished()), SLOT(debugStyleList()));
+ connect(manager, SIGNAL(loadStylesFinished()), SLOT(onStylesLoaded()));
//FIXME move all the demo chat code into a different file, as it will be quite long and in the way.
@@ -31,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) :
ui->chatView->initialise(info);
connect(ui->chatView, SIGNAL(loadFinished(bool)), SLOT(sendDemoMessages()));
+ connect(ui->styleComboBox,SIGNAL(activated(const QString&)),SLOT(onStyleSelected(QString)));
+ connect(ui->variantComboBox,SIGNAL(activated(const QString&)),SLOT(onVariantSelected(const QString&)));
}
MainWindow::~MainWindow()
@@ -38,13 +41,9 @@ MainWindow::~MainWindow()
delete ui;
}
-void MainWindow::debugStyleList()
-{
- qDebug() << ChatWindowStyleManager::self()->getAvailableStyles();
-}
void MainWindow::changeEvent(QEvent *e)
-{/*
+{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
@@ -52,19 +51,89 @@ void MainWindow::changeEvent(QEvent *e)
break;
default:
break;
- }*/
+ }
+}
+
+void MainWindow::onStylesLoaded()
+{
+ kDebug();
+
+ QStringList styles = ChatWindowStyleManager::self()->getAvailableStyles();
+ ChatWindowStyle *currentStyle = ui->chatView->chatStyle();
+
+ ui->styleComboBox->addItems(styles);
+ ui->styleComboBox->setCurrentItem(currentStyle->getStyleName());
+
+ updateVariantsList();
+}
+
+void MainWindow::updateVariantsList()
+{
+ kDebug();
+ QHash<QString, QString> variants = ui->chatView->chatStyle()->getVariants();
+ ui->variantComboBox->clear();
+ ui->variantComboBox->addItems(variants.keys());
+
+ //FIXME maybe - select the correct one.
+ //ui->variantComboBox->setCurrentItem(currentStyle->getCurrentVariantPath());
+
+}
+
+
+void MainWindow::onStyleSelected(const QString & styleName)
+{
+ kDebug();
+ //load the style.
+ ChatWindowStyle* style = ChatWindowStyleManager::self()->getValidStyleFromPool(styleName);
+ ui->chatView->setChatStyle(style);
+ updateVariantsList();
}
+void MainWindow::onVariantSelected(const QString &variant)
+{
+ kDebug();
+ ui->chatView->setVariant(variant);
+}
+
+
void MainWindow::sendDemoMessages()
{
//add a fake message
//in my head Bob Marley is quite a chatty friendly guy...
TelepathyChatMessageInfo message(TelepathyChatMessageInfo::RemoteToLocal);
- message.setMessage("Hello, how are things?");
- message.setSenderDisplayName("BobMarley at yahoo.com");
- message.setSenderScreenName("Bob Marley");
+ message.setMessage("Hello");
+ message.setSenderDisplayName("larry at example.com");
+ message.setSenderScreenName("Larry Demo");
message.setService("Jabber");
message.setTime(QDateTime::currentDateTime());
ui->chatView->addMessage(message);
+
+ message = TelepathyChatMessageInfo(TelepathyChatMessageInfo::LocalToRemote);
+ message.setMessage("A different example message");
+ message.setSenderDisplayName("ted at example.com");
+ message.setSenderScreenName("Ted Example");
+ message.setService("Jabber");
+ message.setTime(QDateTime::currentDateTime());
+ ui->chatView->addMessage(message);
+
+ message = TelepathyChatMessageInfo(TelepathyChatMessageInfo::Status);
+ message.setMessage("Ted Example has left the chat."); //FIXME sync this with chat text logic.
+ message.setTime(QDateTime::currentDateTime());
+ ui->chatView->addMessage(message);
+}
+
+void MainWindow::accept()
+{
+ kDebug();
+
+ KSharedConfigPtr config = KSharedConfig::openConfig("ktelepathyrc");
+ //KConfig config(KGlobal::dirs()->findResource("config","ktelepathyrc"));
+ KConfigGroup appearanceConfig = config->group("Appearance");
+
+ appearanceConfig.writeEntry("styleName", ui->styleComboBox->currentText());
+ appearanceConfig.writeEntry("styleVariant", ui->variantComboBox->currentText());
+
+ appearanceConfig.sync();
+ config->sync();
}
diff --git a/config/mainwindow.h b/config/mainwindow.h
index 97d3bcb..9ba68fd 100644
--- a/config/mainwindow.h
+++ b/config/mainwindow.h
@@ -18,15 +18,18 @@ public:
protected:
void changeEvent(QEvent *e);
-
-public slots:
- void debugStyleList();
+ void accept();
private:
Ui::ChatWindowConfig *ui;
private slots:
void sendDemoMessages();
+ void onStylesLoaded();
+ void updateVariantsList();
+
+ void onStyleSelected(const QString&);
+ void onVariantSelected(const QString&);
};
#endif // MAINWINDOW_H
diff --git a/lib/chatconnection.cpp b/lib/chatconnection.cpp
index fec4af4..493e0b4 100644
--- a/lib/chatconnection.cpp
+++ b/lib/chatconnection.cpp
@@ -33,8 +33,7 @@ ChatConnection::ChatConnection(QObject *parent, const AccountPtr account, const
PendingReady* op = m_channel->becomeReady(Features() << TextChannel::FeatureMessageQueue
<< TextChannel::FeatureMessageSentSignal
<< TextChannel::FeatureChatState
- << Channel::FeatureCore
- );
+ << Channel::FeatureCore);
connect(op, SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onChannelReady(Tp::PendingOperation*)));
diff --git a/lib/chatview.cpp b/lib/chatview.cpp
index 0b1862f..1c6fa45 100644
--- a/lib/chatview.cpp
+++ b/lib/chatview.cpp
@@ -18,6 +18,8 @@
***************************************************************************/
#include "chatview.h"
+#include "chatwindowstylemanager.h"
+
#include <QDebug>
#include <QWebFrame>
#include <QWebElement>
@@ -37,7 +39,8 @@
ChatView::ChatView(QWidget *parent) :
- QWebView(parent)
+ QWebView(parent),
+ m_showHeader(true)
{
//determine the chat window style to use (from the Kopete config file).
//FIXME use our own config file. I think we probably want everything from the appearance config group in ours, so it's a simple change.
@@ -45,7 +48,10 @@ ChatView::ChatView(QWidget *parent) :
KConfig config(KGlobal::dirs()->findResource("config", "kopeterc"));
KConfigGroup appearanceConfig = config.group("Appearance");
- m_chatStyle = new ChatWindowStyle(appearanceConfig.readEntry("styleName")); //FIXME this gets leaked !!!
+ QString chatStyleName = appearanceConfig.readEntry("styleName","Renkoo.AdiumMessageStyle");
+
+ m_chatStyle = ChatWindowStyleManager::self()->getValidStyleFromPool(chatStyleName);
+
if (!m_chatStyle->isValid()) {
KMessageBox::error(this, "Failed to load a valid Kopete theme. Note this current version reads chat window settings from your Kopete config file.");
}
@@ -71,7 +77,7 @@ void ChatView::initialise(const TelepathyChatInfo &chatInfo)
templateHtml = headerStream.readAll();
fileAccess.close();
} else {
- KMessageBox::error(this, "Missing required file Template.html - check your installation.");
+ KMessageBox::error(this, "Missing required file template.html - check your installation.");
}
QString headerHtml;
@@ -86,7 +92,7 @@ void ChatView::initialise(const TelepathyChatInfo &chatInfo)
templateHtml.replace("%footer%", m_chatStyle->getFooterHtml());
setHtml(templateHtml);
-
+ lastSender = "";
//hidden HTML debugging mode. Should have no visible way to turn it on.
if (m_webInspector) {
@@ -95,10 +101,44 @@ void ChatView::initialise(const TelepathyChatInfo &chatInfo)
inspector->setPage(page());
inspector->show();
}
+}
+const QString ChatView::variant() const
+{
+ return m_variantPath;
+}
+void ChatView::setVariant(const QString &variant)
+{
+ m_variantPath = QString("Variants/%1.css").arg(variant);
+
+ //FIXME update the display!
+ initialise(m_chatInfo);
}
+ChatWindowStyle* ChatView::chatStyle() const
+{
+ return m_chatStyle;
+}
+
+void ChatView::setChatStyle(ChatWindowStyle *chatStyle)
+{
+ m_chatStyle = chatStyle;
+
+ //load the first variant
+ QHash<QString, QString> variants = chatStyle->getVariants();
+ if(variants.keys().length() > 0)
+ {
+ m_variantPath = variants.values()[0];
+ }
+ else
+ {
+ m_variantPath = "";
+ }
+
+
+ initialise(m_chatInfo);
+}
void ChatView::addMessage(TelepathyChatMessageInfo & message)
diff --git a/lib/chatview.h b/lib/chatview.h
index 8513436..2920b71 100644
--- a/lib/chatview.h
+++ b/lib/chatview.h
@@ -35,16 +35,32 @@ public:
explicit ChatView(QWidget *parent = 0);
void initialise(const TelepathyChatInfo&);
+ //override various parts loaded from the config file.
+ //note that the following will clear the contents of the chat window.
+
+ const QString variant() const;
+ void setVariant(const QString& variant);
+
+ ChatWindowStyle *chatStyle() const;
+ void setChatStyle(ChatWindowStyle* chatStyle);
+
+ /* bool displayHeader()*/
+ /* .. font, backgrounds, everything else.*/
+
+
public slots:
void addMessage(TelepathyChatMessageInfo & message);
private:
ChatWindowStyle* m_chatStyle;
QString m_variantPath;
+
+
KEmoticons m_emoticons;
QString replaceHeaderKeywords(QString htmlTemplate, const TelepathyChatInfo&);
//QString replaceMessageKeywords(QString htmlTemplate, const TelepathyChatMessageInfo&);
+ TelepathyChatInfo m_chatInfo;
QString lastSender;
bool m_showHeader;
diff --git a/lib/chatwindow.cpp b/lib/chatwindow.cpp
index a9f7235..79e91c3 100644
--- a/lib/chatwindow.cpp
+++ b/lib/chatwindow.cpp
@@ -40,7 +40,6 @@ ChatWindow::ChatWindow(ChatConnection* chat, QWidget *parent) :
//chat connection lifespan should be same as the chatwindow
m_chatConnection->setParent(this);
-
connect(m_chatConnection, SIGNAL(channelReadyStateChanged(bool)), SLOT(updateEnabledState(bool)));
connect(m_chatConnection->channel().data(), SIGNAL(messageReceived(Tp::ReceivedMessage)), SLOT(handleIncomingMessage(Tp::ReceivedMessage)));
connect(m_chatConnection->channel().data(), SIGNAL(messageSent(Tp::Message, Tp::MessageSendingFlags, QString)), SLOT(handleMessageSent(Tp::Message, Tp::MessageSendingFlags, QString)));
@@ -230,6 +229,15 @@ void ChatWindow::updateEnabledState(bool enable)
}
}
+
+void ChatWindow::onInputBoxChanged()
+{
+ //if the box is empty
+ bool currentlyTyping = ui->sendMessageBox->toPlainText().isEmpty();
+
+
+}
+
bool MessageBoxEventFilter::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
diff --git a/lib/chatwindow.h b/lib/chatwindow.h
index ed8c48c..1a42c5c 100644
--- a/lib/chatwindow.h
+++ b/lib/chatwindow.h
@@ -70,8 +70,12 @@ protected slots:
void onContactPresenceChange(Tp::ContactPtr, uint type);
+ void onInputBoxChanged();
+
void chatViewReady();
+
+
signals:
void titleChanged(QString title);
@@ -83,6 +87,7 @@ private:
bool m_chatviewlInitialised;
MessageBoxEventFilter* messageBoxEventFilter;
+ ChannelChatState lastRequestedChannelChatState;
};
#endif // CHATWINDOW_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list