/***************************************************************************
- * Copyright (C) 2005-07 by the Quassel IRC Team *
+ * Copyright (C) 2005-08 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+//#define SPUTDEV
#include "mainwin.h"
#include "client.h"
#include "coreconnectdlg.h"
#include "networkmodel.h"
+#include "buffermodel.h"
#include "nicklistwidget.h"
#include "serverlist.h"
#include "settingsdlg.h"
#include "signalproxy.h"
-
#include "topicwidget.h"
+#include "uisettings.h"
#include "selectionmodelsynchronizer.h"
#include "mappedselectionmodel.h"
ui.menuViews->addAction(nickDock->toggleViewAction());
// restore mainwin state
- QSettings s;
- s.beginGroup("Geometry");
- //resize(s.value("MainWinSize", QSize(500, 400)).toSize());
- //move(s.value("MainWinPos", QPoint(50, 50)).toPoint());
- if(s.contains("MainWinState")) restoreState(s.value("MainWinState").toByteArray());
- s.endGroup();
-
- //s.beginGroup("Buffers");
- //QString net = s.value("CurrentNetwork", "").toString();
- //QString buf = s.value("CurrentBuffer", "").toString();
- //s.endGroup();
+ UiSettings s;
+ restoreState(s.value("MainWinState").toByteArray());
disconnectedFromCore(); // Disable menus and stuff
showCoreConnectionDlg(true); // autoconnect if appropriate
TopicWidget *topicwidget = new TopicWidget(dock);
dock->setWidget(topicwidget);
- Client::networkModel()->mapProperty(1, Qt::DisplayRole, topicwidget, "topic");
+ Client::bufferModel()->mapProperty(1, Qt::DisplayRole, topicwidget, "topic");
addDockWidget(Qt::TopDockWidgetArea, dock);
ui.menuViews->addAction(dock->toggleViewAction());
- //showSettingsDlg();
+
+ // attach the BufferWidget to the PropertyMapper
+ Client::bufferModel()->mapProperty(0, NetworkModel::BufferIdRole, ui.bufferWidget, "currentBuffer");
+ connect(Client::networkModel(), SIGNAL(bufferAboutToBeRemoved(BufferId)),
+ ui.bufferWidget, SLOT(removeBuffer(BufferId)));
+
+ // attach the NickList to the PropertyMapper
+ Client::bufferModel()->mapProperty(0, NetworkModel::BufferIdRole, nickListWidget, "currentBuffer");
+
+
+#ifdef SPUTDEV
+ showSettingsDlg();
+#endif
}
connect(ui.actionEditIdentities, SIGNAL(triggered()), serverListDlg, SLOT(editIdentities()));
connect(ui.actionSettingsDlg, SIGNAL(triggered()), this, SLOT(showSettingsDlg()));
connect(ui.actionDebug_Console, SIGNAL(triggered()), this, SLOT(showDebugConsole()));
- //ui.actionSettingsDlg->setEnabled(false);
connect(ui.actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt()));
}
void MainWin::setupViews() {
-
- NetworkModel *model = Client::networkModel();
- connect(model, SIGNAL(bufferSelected(Buffer *)), this, SLOT(showBuffer(Buffer *)));
+ BufferModel *model = Client::bufferModel();
addBufferView(tr("All Buffers"), model, BufferViewFilter::AllNets, QList<uint>());
addBufferView(tr("All Channels"), model, BufferViewFilter::AllNets|BufferViewFilter::NoQueries|BufferViewFilter::NoServers, QList<uint>());
addBufferView(tr("All Queries"), model, BufferViewFilter::AllNets|BufferViewFilter::NoChannels|BufferViewFilter::NoServers, QList<uint>());
addBufferView(tr("All Networks"), model, BufferViewFilter::AllNets|BufferViewFilter::NoChannels|BufferViewFilter::NoQueries, QList<uint>());
addBufferView(tr("Full Custom"), model, BufferViewFilter::FullCustom, QList<uint>());
-
+
ui.menuViews->addSeparator();
}
QDockWidget *dock = new QDockWidget(viewname, this);
dock->setObjectName(QString("ViewDock-" + viewname)); // should be unique for mainwindow state!
dock->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea);
- //dock->setContentsMargins(4,4,4,4);
//create the view and initialize it's filter
BufferView *view = new BufferView(dock);
+ view->show();
view->setFilteredModel(model, mode, nets);
- Client::networkModel()->synchronizeView(view);
+ Client::bufferModel()->synchronizeView(view);
dock->setWidget(view);
-
+ dock->show();
+
addDockWidget(Qt::LeftDockWidgetArea, dock);
ui.menuViews->addAction(dock->toggleViewAction());
void MainWin::setupSettingsDlg() {
settingsDlg->registerSettingsPage(new FontsSettingsPage(settingsDlg));
settingsDlg->registerSettingsPage(new IdentitiesSettingsPage(settingsDlg));
-
}
void MainWin::connectedToCore() {
coreConnectDlg = new CoreConnectDlg(this, autoConnect);
connect(coreConnectDlg, SIGNAL(finished(int)), this, SLOT(coreConnectionDlgFinished(int)));
coreConnectDlg->setModal(true);
- if(!autoConnect || !coreConnectDlg->willDoInternalAutoConnect())
+ //if(!autoConnect || !coreConnectDlg->willDoInternalAutoConnect())
coreConnectDlg->show(); // avoid flicker and show dlg only if we do remote connect, which needs a progress bar
- if(autoConnect) coreConnectDlg->doAutoConnect();
+ //if(autoConnect) coreConnectDlg->doAutoConnect();
}
void MainWin::coreConnectionDlgFinished(int /*code*/) {
-
coreConnectDlg->close();
+ //exit(1);
}
{
//if (userReallyWantsToQuit()) {
ui.bufferWidget->saveState();
- QSettings s;
- s.beginGroup("Geometry");
+ UiSettings s;
s.setValue("MainWinSize", size());
s.setValue("MainWinPos", pos());
s.setValue("MainWinState", saveState());
- s.endGroup();
- s.beginGroup("Buffers");
- //s.setValue("CurrentNetwork", currentNetwork);
- s.setValue("CurrentBuffer", currentBuffer);
- s.endGroup();
delete systray;
event->accept();
//} else {
//}
}
-void MainWin::showBuffer(BufferInfo id) {
- showBuffer(Client::buffer(id));
-}
-
-void MainWin::showBuffer(Buffer *b) {
- currentBuffer = b->bufferInfo().groupId();
- //emit bufferSelected(b);
- //qApp->processEvents();
- ui.bufferWidget->setBuffer(b);
- nickListWidget->setBuffer(b);
- //if(b->bufferType() == Buffer::ChannelType) nickDock->show();
- //else nickDock->hide();
- //emit bufferSelected(b);
-}