Well that means the input line can now be moved around or undocked or even hidden.
This new dock aswell as the topic dock have new vertical layouted titlewidget.
void setCoreConfiguration(const QVariantMap &settings);
+ void userInput(BufferInfo, QString);
private slots:
void recvSessionData(const QString &key, const QVariant &data);
//void coreSocketError(QAbstractSocket::SocketError);
- void userInput(BufferInfo, QString);
-
//void networkConnected(NetworkId);
//void networkDisconnected(NetworkId);
return qVariantFromValue(bufferInfo().uid());
case NetworkModel::NetworkIdRole:
return qVariantFromValue(bufferInfo().networkId());
+ case NetworkModel::BufferInfoRole:
+ return qVariantFromValue(bufferInfo());
case NetworkModel::BufferTypeRole:
return int(bufferType());
case NetworkModel::ItemActiveRole:
ItemActiveRole,
BufferIdRole,
NetworkIdRole,
+ BufferInfoRole,
ItemTypeRole
};
_selectionModel(0)
{
ui.setupUi(this);
- ui.ownNick->clear(); // TODO add nick history
- connect(ui.inputEdit, SIGNAL(returnPressed()), this, SLOT(enterPressed()));
- connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString)));
}
BufferWidget::~BufferWidget() {
return;
setCurrentBuffer(qVariantValue<BufferId>(variant));
- updateNickSelector();
}
void BufferWidget::setCurrentBuffer(BufferId bufferId) {
connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatWidget, SLOT(prependMsg(AbstractUiMsg *)));
_chatWidgets[bufferId] = chatWidget;
ui.stackedWidget->addWidget(chatWidget);
+ chatWidget->setFocusProxy(this);
}
ui.stackedWidget->setCurrentWidget(chatWidget);
- disconnect(this, SIGNAL(userInput(QString)), 0, 0);
- connect(this, SIGNAL(userInput(QString)), Client::buffer(bufferId), SLOT(processUserInput(QString)));
- chatWidget->setFocusProxy(ui.inputEdit);
- ui.inputEdit->setFocus();
-
-}
-
-const Network *BufferWidget::currentNetwork() const {
- if(!selectionModel())
- return 0;
-
- QVariant variant = selectionModel()->currentIndex().data(NetworkModel::NetworkIdRole);
- if(!variant.isValid())
- return 0;
-
- return Client::network(variant.value<NetworkId>());
-}
-
-void BufferWidget::updateNickSelector() const {
- const Network *net = currentNetwork();
- if(!net)
- return;
-
- const Identity *identity = Client::identity(net->identity());
- if(!identity) {
- qWarning() << "BufferWidget::setCurrentNetwork(): can't find Identity for Network" << net->networkId();
- return;
- }
-
- int nickIdx;
- QStringList nicks = identity->nicks();
- if((nickIdx = nicks.indexOf(net->myNick())) == -1) {
- nicks.prepend(net->myNick());
- nickIdx = 0;
- }
-
- ui.ownNick->clear();
- ui.ownNick->addItems(nicks);
- ui.ownNick->setCurrentIndex(nickIdx);
-}
-
-void BufferWidget::changeNick(const QString &newNick) const {
- const Network *net = currentNetwork();
- if(!net || net->isMyNick(newNick))
- return;
- emit userInput(QString("/nick %1").arg(newNick));
-}
-
-void BufferWidget::enterPressed() {
- QStringList lines = ui.inputEdit->text().split('\n', QString::SkipEmptyParts);
- foreach(QString msg, lines) {
- if(msg.isEmpty()) continue;
- emit userInput(msg);
- }
- ui.inputEdit->clear();
+ setFocus();
}
class Network;
class ChatView;
class ChatWidget;
-class LayoutThread;
#include "buffermodel.h"
#include <QItemSelectionModel>
inline QItemSelectionModel *selectionModel() const { return _selectionModel; }
void setSelectionModel(QItemSelectionModel *selectionModel);
-
- const Network *currentNetwork() const;
-signals:
- void userInput(QString msg) const;
- void aboutToClose();
-
protected slots:
// virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
// virtual void commitData(QWidget *editor);
// virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
private slots:
- void enterPressed();
- void changeNick(const QString &newNick) const;
void removeBuffer(BufferId bufferId);
-
void setCurrentBuffer(BufferId bufferId);
- void updateNickSelector() const;
private:
Ui::BufferWidget ui;
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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) version 3. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "inputwidget.h"
+
+#include "client.h"
+#include "networkmodel.h"
+#include "network.h"
+#include "identity.h"
+
+InputWidget::InputWidget(QWidget *parent)
+ : QWidget(parent),
+ validBuffer(false),
+ _bufferModel(0),
+ _selectionModel(0)
+{
+ ui.setupUi(this);
+ connect(ui.inputEdit, SIGNAL(returnPressed()), this, SLOT(enterPressed()));
+ connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString)));
+ connect(this, SIGNAL(userInput(BufferInfo, QString)), Client::instance(), SLOT(userInput(BufferInfo, QString)));
+ setFocusProxy(ui.inputEdit);
+}
+
+InputWidget::~InputWidget() {
+}
+
+void InputWidget::setModel(BufferModel *bufferModel) {
+ _bufferModel = bufferModel;
+}
+
+void InputWidget::setSelectionModel(QItemSelectionModel *selectionModel) {
+ if(_selectionModel) {
+ disconnect(_selectionModel, 0, this, 0);
+ }
+ _selectionModel = selectionModel;
+ connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
+ this, SLOT(currentChanged(QModelIndex, QModelIndex)));
+}
+
+void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
+ Q_UNUSED(previous);
+
+ validBuffer = current.isValid();
+
+ if(!validBuffer)
+ return;
+
+ QVariant variant;
+ variant = current.data(NetworkModel::BufferInfoRole);
+ if(!variant.isValid())
+ return;
+
+ currentBufferInfo = current.data(NetworkModel::BufferInfoRole).value<BufferInfo>();
+ updateNickSelector();
+}
+
+const Network *InputWidget::currentNetwork() const {
+ if(!validBuffer)
+ return 0;
+
+ return Client::network(currentBufferInfo.networkId());
+}
+
+void InputWidget::updateNickSelector() const {
+ const Network *net = currentNetwork();
+ if(!net)
+ return;
+
+ const Identity *identity = Client::identity(net->identity());
+ if(!identity) {
+ qWarning() << "InputWidget::updateNickSelector(): can't find Identity for Network" << net->networkId();
+ return;
+ }
+
+ int nickIdx;
+ QStringList nicks = identity->nicks();
+ if((nickIdx = nicks.indexOf(net->myNick())) == -1) {
+ nicks.prepend(net->myNick());
+ nickIdx = 0;
+ }
+
+ ui.ownNick->clear();
+ ui.ownNick->addItems(nicks);
+ ui.ownNick->setCurrentIndex(nickIdx);
+}
+
+void InputWidget::changeNick(const QString &newNick) const {
+ const Network *net = currentNetwork();
+ if(!net || net->isMyNick(newNick))
+ return;
+ emit userInput(currentBufferInfo, QString("/nick %1").arg(newNick));
+}
+
+void InputWidget::enterPressed() {
+ QStringList lines = ui.inputEdit->text().split('\n', QString::SkipEmptyParts);
+ foreach(QString msg, lines) {
+ if(msg.isEmpty()) continue;
+ emit userInput(currentBufferInfo, msg);
+ }
+ ui.inputEdit->clear();
+}
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-08 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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) version 3. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef INPUTWIDGET_H
+#define INPUTWIDGET_H
+
+#include "ui_inputwidget.h"
+#include <QPointer>
+#include <QItemSelectionModel>
+
+#include "buffermodel.h"
+#include "bufferinfo.h"
+
+class Network;
+
+class InputWidget : public QWidget {
+ Q_OBJECT
+
+public:
+ InputWidget(QWidget *parent = 0);
+ virtual ~InputWidget();
+
+ inline BufferModel *model() { return _bufferModel; }
+ void setModel(BufferModel *bufferModel);
+
+ inline QItemSelectionModel *selectionModel() const { return _selectionModel; }
+ void setSelectionModel(QItemSelectionModel *selectionModel);
+
+ const Network *currentNetwork() const;
+
+protected slots:
+// virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint);
+// virtual void commitData(QWidget *editor);
+ virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
+// virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+// virtual void editorDestroyed(QObject *editor);
+// virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+// virtual void rowsInserted(const QModelIndex &parent, int start, int end);
+// virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
+
+private slots:
+ void enterPressed();
+ void changeNick(const QString &newNick) const;
+
+ void updateNickSelector() const;
+
+signals:
+ void userInput(BufferInfo, QString msg) const;
+
+private:
+ Ui::InputWidget ui;
+
+ bool validBuffer;
+ BufferInfo currentBufferInfo;
+
+ QPointer<BufferModel> _bufferModel;
+ QPointer<QItemSelectionModel> _selectionModel;
+
+};
+
+#endif // INPUTWIDGET_H
#include "settingsdlg.h"
#include "signalproxy.h"
#include "topicwidget.h"
+#include "inputwidget.h"
+#include "verticaldocktitle.h"
#include "uisettings.h"
#include "selectionmodelsynchronizer.h"
// new Topic Stuff... should be probably refactored out into a separate method
-
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
- QDockWidget *dock = new QDockWidget(tr("Topic Dock"), this);
- dock->setObjectName("TopicDock");
- dock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
+ QDockWidget *topicDock = new QDockWidget(tr("Topic"), this);
+ topicDock->setObjectName("TopicDock");
+ topicDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
+
+ QWidget *oldDockTitle = topicDock->titleBarWidget();
+
+ QWidget *newDockTitle = new VerticalDockTitle(topicDock);
+ topicDock->setFeatures(topicDock->features() | QDockWidget::DockWidgetVerticalTitleBar);
+ topicDock->setTitleBarWidget(newDockTitle);
+
+ if(oldDockTitle)
+ oldDockTitle->deleteLater();
+
- TopicWidget *topicwidget = new TopicWidget(dock);
- dock->setWidget(topicwidget);
+ TopicWidget *topicwidget = new TopicWidget(topicDock);
+ topicDock->setWidget(topicwidget);
Client::bufferModel()->mapProperty(1, Qt::DisplayRole, topicwidget, "topic");
- addDockWidget(Qt::TopDockWidgetArea, dock);
+ addDockWidget(Qt::TopDockWidgetArea, topicDock);
- ui.menuViews->addAction(dock->toggleViewAction());
+ ui.menuViews->addAction(topicDock->toggleViewAction());
+ // NEW INPUT WIDGET -- damn init() needs a cleanup
+ QDockWidget *inputDock = new QDockWidget(tr("Inputline"), this);
+ inputDock->setObjectName("InputDock");
+ inputDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
+ oldDockTitle = inputDock->titleBarWidget();
+ newDockTitle = new VerticalDockTitle(inputDock);
+
+ inputDock->setFeatures(inputDock->features() | QDockWidget::DockWidgetVerticalTitleBar);
+ inputDock->setTitleBarWidget(newDockTitle);
+
+ if(oldDockTitle)
+ oldDockTitle->deleteLater();
+
+ InputWidget *inputWidget = new InputWidget(inputDock);
+ inputDock->setWidget(inputWidget);
+
+ addDockWidget(Qt::BottomDockWidgetArea, inputDock);
+ ui.menuViews->addAction(inputDock->toggleViewAction());
+
+
+ inputWidget->setModel(Client::bufferModel());
+ inputWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
+
+ ui.bufferWidget->setFocusProxy(inputWidget);
+
// attach the BufferWidget to the PropertyMapper
ui.bufferWidget->setModel(Client::bufferModel());
ui.bufferWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
-}
\ No newline at end of file
+}
#include "qtui.h"
#include "bufferviewfilter.h"
+#include <QSystemTrayIcon>
+
class ServerListDlg;
class CoreConnectDlg;
class Buffer;
class QtUi;
class Message;
class NickListWidget;
-
class DebugConsole;
//!\brief The main window of Quassel's QtUi.
SRCS += bufferwidget.cpp chatline-old.cpp \
chatwidget.cpp coreconnectdlg.cpp configwizard.cpp \
guisettings.cpp identities.cpp mainwin.cpp nicklistwidget.cpp qtui.cpp qtuistyle.cpp serverlist.cpp settingsdlg.cpp \
- topicwidget.cpp debugconsole.cpp
+ topicwidget.cpp debugconsole.cpp inputwidget.cpp
HDRS += bufferwidget.h chatline-old.h chatwidget.h configwizard.h \
coreconnectdlg.h guisettings.h identities.h mainwin.h nicklistwidget.h qtui.h qtuistyle.h serverlist.h settingsdlg.h \
- topicwidget.h debugconsole.h
+ topicwidget.h debugconsole.h inputwidget.h
FORMNAMES = identitiesdlg.ui identitieseditdlg.ui networkeditdlg.ui mainwin.ui nickeditdlg.ui serverlistdlg.ui \
servereditdlg.ui coreaccounteditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \
- topicwidget.ui debugconsole.ui
+ topicwidget.ui debugconsole.ui inputwidget.ui
for(ui, FORMNAMES) {
FRMS += ui/$${ui}
</widget>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QComboBox" name="ownNick" >
- <property name="sizeAdjustPolicy" >
- <enum>QComboBox::AdjustToContents</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="InputLine" name="inputEdit" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>InputLine</class>
- <extends>QLineEdit</extends>
- <header>inputline.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>inputEdit</tabstop>
- <tabstop>ownNick</tabstop>
- </tabstops>
<resources/>
<connections/>
</ui>
--- /dev/null
+<ui version="4.0" >
+ <class>InputWidget</class>
+ <widget class="QWidget" name="InputWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>674</width>
+ <height>136</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QComboBox" name="ownNick" />
+ </item>
+ <item>
+ <widget class="InputLine" name="inputEdit" />
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>InputLine</class>
+ <extends>QLineEdit</extends>
+ <header>inputline.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
DEPMOD = common client
QT_MOD = core gui network
-SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp uistylesettings.cpp
-HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h uistylesettings.h
+SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp settingspage.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp uistylesettings.cpp verticaldocktitle.cpp
+HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h settingspage.h tabcompleter.h uisettings.h uistyle.h uistylesettings.h verticaldocktitle.h
FORMNAMES =
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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) version 3. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "verticaldocktitle.h"
+#include <QDockWidget>
+#include <QPainter>
+#include <QStyleOption>
+
+#include <QDebug>
+
+VerticalDockTitle::VerticalDockTitle(QDockWidget *parent)
+ : QWidget(parent)
+{
+}
+
+VerticalDockTitle::~VerticalDockTitle() {
+}
+
+QSize VerticalDockTitle::sizeHint() const {
+ return QSize(10, 20);
+}
+
+QSize VerticalDockTitle::minimumSizeHint() const {
+ return QSize(10, 20);
+}
+
+void VerticalDockTitle::paintEvent(QPaintEvent *event) {
+ Q_UNUSED(event);
+
+ QPainter painter(this);
+
+ if(rect().isValid() && rect().height() > minimumSizeHint().height()) {
+ for(int i = 0; i < 2; i++) {
+ QPoint topLeft = rect().topLeft() + QPoint(3 + i*2, 5);
+ QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 5);
+ qDrawShadeLine(&painter, topLeft, bottomRight, palette());
+ }
+ }
+
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005/06 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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) version 3. *
+ * *
+ * 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef VERTICALDOCKTITLE_H
+#define VERTICALDOCKTITLE_H
+
+#include <QWidget>
+#include <QSize>
+
+class QDockWidget;
+
+class VerticalDockTitle : public QWidget {
+ Q_OBJECT
+
+public:
+ VerticalDockTitle(QDockWidget *parent);
+ virtual ~VerticalDockTitle();
+
+ virtual QSize sizeHint() const;
+ virtual QSize minimumSizeHint() const;
+
+protected:
+ virtual void paintEvent(QPaintEvent *event);
+};
+
+
+#endif // VERTICALDOCKTITLE_H
+
{ using namespace Global;
quasselVersion = "0.2.0-pre";
- quasselDate = "2008-01-23";
- quasselBuild = 388;
+ quasselDate = "2008-01-26";
+ quasselBuild = 389;
//! Minimum client build number the core needs
clientBuildNeeded = 358;