projects
/
quassel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d1a410b
)
Sanified multiple inheritance for AbstractChatView.
author
Manuel Nickschas
<sputnick@quassel-irc.org>
Sat, 5 Apr 2008 21:34:54 +0000
(21:34 +0000)
committer
Manuel Nickschas
<sputnick@quassel-irc.org>
Sat, 5 Apr 2008 21:34:54 +0000
(21:34 +0000)
src/qtui/bufferwidget.cpp
patch
|
blob
|
history
src/qtui/bufferwidget.h
patch
|
blob
|
history
src/uisupport/abstractbuffercontainer.cpp
patch
|
blob
|
history
src/uisupport/abstractbuffercontainer.h
patch
|
blob
|
history
version.inc
patch
|
blob
|
history
diff --git
a/src/qtui/bufferwidget.cpp
b/src/qtui/bufferwidget.cpp
index
a670705
..
4158311
100644
(file)
--- a/
src/qtui/bufferwidget.cpp
+++ b/
src/qtui/bufferwidget.cpp
@@
-37,24
+37,28
@@
BufferWidget::~BufferWidget() {
}
AbstractChatView *BufferWidget::createChatView(BufferId id) {
}
AbstractChatView *BufferWidget::createChatView(BufferId id) {
-
AbstractChatView
*chatView;
+
QWidget
*chatView;
if(Global::SPUTDEV) {
chatView = new ChatView(Client::buffer(id), this);
} else {
chatView = new ChatWidget(id, this);
}
if(Global::SPUTDEV) {
chatView = new ChatView(Client::buffer(id), this);
} else {
chatView = new ChatWidget(id, this);
}
- ui.stackedWidget->addWidget(dynamic_cast<QWidget *>(chatView));
- dynamic_cast<QWidget *>(chatView)->setFocusProxy(this);
- return chatView;
+ _chatViews[id] = chatView;
+ ui.stackedWidget->addWidget(chatView);
+ chatView->setFocusProxy(this);
+ return dynamic_cast<AbstractChatView*>(chatView);
}
}
-void BufferWidget::removeChatView(AbstractChatView *view) {
- ui.stackedWidget->removeWidget(dynamic_cast<QWidget *>(view));
- dynamic_cast<QWidget *>(view)->deleteLater();
+void BufferWidget::removeChatView(BufferId id) {
+ QWidget *view = _chatViews.value(id, 0);
+ if(!view) return;
+ ui.stackedWidget->removeWidget(view);
+ view->deleteLater();
+ _chatViews.take(id);
}
}
-void BufferWidget::showChatView(
AbstractChatView *view
) {
- if(!
view
) ui.stackedWidget->setCurrentWidget(ui.page);
- else ui.stackedWidget->setCurrentWidget(
dynamic_cast<QWidget *>(view
));
+void BufferWidget::showChatView(
BufferId id
) {
+ if(!
id.isValid()
) ui.stackedWidget->setCurrentWidget(ui.page);
+ else ui.stackedWidget->setCurrentWidget(
_chatViews.value(id
));
}
}
diff --git
a/src/qtui/bufferwidget.h
b/src/qtui/bufferwidget.h
index
17e939d
..
4d9bf56
100644
(file)
--- a/
src/qtui/bufferwidget.h
+++ b/
src/qtui/bufferwidget.h
@@
-34,14
+34,14
@@
class BufferWidget : public AbstractBufferContainer {
protected:
virtual AbstractChatView *createChatView(BufferId);
protected:
virtual AbstractChatView *createChatView(BufferId);
- virtual void removeChatView(
AbstractChatView *view
);
+ virtual void removeChatView(
BufferId
);
protected slots:
protected slots:
- virtual void showChatView(
AbstractChatView *view
);
+ virtual void showChatView(
BufferId
);
private:
Ui::BufferWidget ui;
private:
Ui::BufferWidget ui;
-
+ QHash<BufferId, QWidget *> _chatViews;
};
#endif
};
#endif
diff --git
a/src/uisupport/abstractbuffercontainer.cpp
b/src/uisupport/abstractbuffercontainer.cpp
index
78ead27
..
1444027
100644
(file)
--- a/
src/uisupport/abstractbuffercontainer.cpp
+++ b/
src/uisupport/abstractbuffercontainer.cpp
@@
-42,13
+42,10
@@
void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, in
if(model()->rowCount(parent) != end - start + 1)
return;
if(model()->rowCount(parent) != end - start + 1)
return;
- AbstractChatView *chatView;
- QHash<BufferId, AbstractChatView *>::iterator iter = _chatViews.begin();
- while(iter != _chatViews.end()) {
- chatView = *iter;
- iter = _chatViews.erase(iter);
- removeChatView(chatView);
+ foreach(BufferId id, _chatViews.keys()) {
+ removeChatView(id);
}
}
+ _chatViews.clear();
} else {
// check if there are explicitly buffers removed
for(int i = start; i <= end; i++) {
} else {
// check if there are explicitly buffers removed
for(int i = start; i <= end; i++) {
@@
-63,19
+60,21
@@
void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, in
}
void AbstractBufferContainer::removeBuffer(BufferId bufferId) {
}
void AbstractBufferContainer::removeBuffer(BufferId bufferId) {
+ if(Client::buffer(bufferId)) Client::buffer(bufferId)->setVisible(false);
if(!_chatViews.contains(bufferId))
return;
if(!_chatViews.contains(bufferId))
return;
- if(Client::buffer(bufferId)) Client::buffer(bufferId)->setVisible(false);
- AbstractChatView *chatView = _chatViews.take(bufferId);
- removeChatView(chatView);
+ removeChatView(bufferId);
+ _chatViews.take(bufferId);
}
void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
BufferId newBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>();
BufferId oldBufferId = previous.data(NetworkModel::BufferIdRole).value<BufferId>();
}
void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
BufferId newBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>();
BufferId oldBufferId = previous.data(NetworkModel::BufferIdRole).value<BufferId>();
- if(newBufferId != oldBufferId)
+ if(newBufferId != oldBufferId)
{
setCurrentBuffer(newBufferId);
setCurrentBuffer(newBufferId);
+ emit currentChanged(newBufferId);
+ }
}
void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) {
}
void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) {
@@
-102,7
+101,7
@@
void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) {
_chatViews[bufferId] = chatView;
}
_currentBuffer = bufferId;
_chatViews[bufferId] = chatView;
}
_currentBuffer = bufferId;
- showChatView(
chatView
);
+ showChatView(
bufferId
);
buf->setVisible(true);
setFocus();
}
buf->setVisible(true);
setFocus();
}
diff --git
a/src/uisupport/abstractbuffercontainer.h
b/src/uisupport/abstractbuffercontainer.h
index
a8c5055
..
cb0e502
100644
(file)
--- a/
src/uisupport/abstractbuffercontainer.h
+++ b/
src/uisupport/abstractbuffercontainer.h
@@
-37,6
+37,9
@@
class AbstractBufferContainer : public AbstractItemView {
inline BufferId currentBuffer() const { return _currentBuffer; }
inline BufferId currentBuffer() const { return _currentBuffer; }
+ signals:
+ void currentChanged(BufferId);
+
protected:
//! Create an AbstractChatView for the given BufferId and add it to the UI if necessary
virtual AbstractChatView *createChatView(BufferId) = 0;
protected:
//! Create an AbstractChatView for the given BufferId and add it to the UI if necessary
virtual AbstractChatView *createChatView(BufferId) = 0;
@@
-46,7
+49,7
@@
class AbstractBufferContainer : public AbstractItemView {
* It also shall delete the object afterwards.
* \param view The chat view to be removed and deleted
*/
* It also shall delete the object afterwards.
* \param view The chat view to be removed and deleted
*/
- virtual void removeChatView(
AbstractChatView *view
) = 0;
+ virtual void removeChatView(
BufferId
) = 0;
protected slots:
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
protected slots:
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
@@
-57,7
+60,7
@@
class AbstractBufferContainer : public AbstractItemView {
* selecting the appropriate page in a QStackedWidget.
* \param view The chat view to be displayed. May be 0 if no chat view is selected.
*/
* selecting the appropriate page in a QStackedWidget.
* \param view The chat view to be displayed. May be 0 if no chat view is selected.
*/
- virtual void showChatView(
AbstractChatView *view
) = 0;
+ virtual void showChatView(
BufferId
) = 0;
private slots:
void appendMsg(AbstractUiMsg *);
private slots:
void appendMsg(AbstractUiMsg *);
@@
-77,6
+80,7
@@
class AbstractChatView {
virtual void appendMsg(AbstractUiMsg *msg) = 0;
virtual void prependMsg(AbstractUiMsg *msg) = 0;
virtual void setContents(const QList<AbstractUiMsg *> &contents) = 0;
virtual void appendMsg(AbstractUiMsg *msg) = 0;
virtual void prependMsg(AbstractUiMsg *msg) = 0;
virtual void setContents(const QList<AbstractUiMsg *> &contents) = 0;
+ //virtual BufferId bufferId() const = 0;
};
};
diff --git
a/version.inc
b/version.inc
index
e45335a
..
abdc3f7
100644
(file)
--- a/
version.inc
+++ b/
version.inc
@@
-5,7
+5,7
@@
quasselVersion = "0.2.0-alpha5-pre";
quasselDate = "2008-04-05";
quasselVersion = "0.2.0-alpha5-pre";
quasselDate = "2008-04-05";
- quasselBuild = 70
2
;
+ quasselBuild = 70
6
;
//! Minimum client build number the core needs
clientBuildNeeded = 642;
//! Minimum client build number the core needs
clientBuildNeeded = 642;