1 /***************************************************************************
2 * Copyright (C) 2005-08 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "debugbufferviewoverlay.h"
23 #include <QFormLayout>
28 #include "buffermodel.h"
29 #include "bufferviewoverlay.h"
30 #include "bufferviewoverlayfilter.h"
33 DebugBufferViewOverlay::DebugBufferViewOverlay(QWidget *parent)
38 BufferViewOverlayFilter *filter = new BufferViewOverlayFilter(Client::bufferModel(), Client::bufferViewOverlay());
40 filter->setParent(ui.bufferView);
42 ui.bufferView->setModel(filter);
43 ui.bufferView->setColumnWidth(0, 250);
44 ui.bufferView->setColumnWidth(1, 250);
45 ui.bufferView->setColumnWidth(2, 80);
46 ui.bufferView->resize(610, 300);
47 ui.bufferView->show();
49 QFormLayout *layout = new QFormLayout(ui.overlayProperties);
50 layout->addRow(tr("BufferViews:"), _bufferViews = new QLineEdit(this));
51 layout->addRow(tr("All Networks:"), _allNetworks = new QLabel(this));
52 layout->addRow(tr("Networks:"), _networks = new QLineEdit(this));
53 layout->addRow(tr("Buffers:"), _bufferIds = new QTextEdit(this));
54 layout->addRow(tr("Removed buffers:"), _removedBufferIds = new QTextEdit(this));
55 layout->addRow(tr("Temp. removed buffers:"), _tempRemovedBufferIds = new QTextEdit(this));
57 layout->addRow(tr("Allowed buffer types:"), _allowedBufferTypes = new QLabel(this));
58 layout->addRow(tr("Minimum activity:"), _minimumActivity = new QLabel(this));
60 layout->addRow(tr("Is initialized:"), _isInitialized = new QLabel(this));
63 connect(Client::bufferViewOverlay(), SIGNAL(hasChanged()), this, SLOT(update()));
66 void DebugBufferViewOverlay::update() {
67 BufferViewOverlay *overlay = Client::bufferViewOverlay();
69 _allNetworks->setText(overlay->allNetworks() ? "yes" : "no");
72 foreach(int bufferViewId, overlay->bufferViewIds()) {
73 ids << QString::number(bufferViewId);
75 _bufferViews->setText(ids.join(", "));
78 foreach(NetworkId networkId, overlay->networkIds()) {
79 ids << QString::number(networkId.toInt());
81 _networks->setText(ids.join(", "));
84 foreach(BufferId bufferId, overlay->bufferIds()) {
85 ids << QString::number(bufferId.toInt());
87 _bufferIds->setText(ids.join(", "));
90 foreach(BufferId bufferId, overlay->removedBufferIds()) {
91 ids << QString::number(bufferId.toInt());
93 _removedBufferIds->setText(ids.join(", "));
96 foreach(BufferId bufferId, overlay->tempRemovedBufferIds()) {
97 ids << QString::number(bufferId.toInt());
99 _tempRemovedBufferIds->setText(ids.join(", "));
101 _allowedBufferTypes->setText(QString::number(overlay->allowedBufferTypes()));
102 _minimumActivity->setText(QString::number(overlay->minimumActivity()));
104 _isInitialized->setText(overlay->isInitialized() ? "yes" : "no");