+ setupNickWidget();
+ setupTopicWidget();
+ setupChatMonitor();
+ setupInputWidget();
+
+ QAction *toggleLockDocksAction = ui.menuViews->addAction(tr("Lock dock positions"));
+ toggleLockDocksAction->setCheckable(true);
+ connect(toggleLockDocksAction, SIGNAL(toggled(bool)), this, SLOT(lockVerticalDocks(bool)));
+ toggleLockDocksAction->setChecked(s.value("LockDocks", false).toBool());
+
+ setupStatusBar();
+ setupSystray();
+
+ setupSettingsDlg();
+
+ // restore mainwin state
+ restoreState(s.value("MainWinState").toByteArray());
+
+ setDisconnectedState(); // Disable menus and stuff
+ showCoreConnectionDlg(true); // autoconnect if appropriate
+
+ // attach the BufferWidget to the BufferModel and the default selection
+ ui.bufferWidget->setModel(Client::bufferModel());
+ ui.bufferWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
+
+ _titleSetter.setModel(Client::bufferModel());
+ _titleSetter.setSelectionModel(Client::bufferModel()->standardSelectionModel());
+}
+
+MainWin::~MainWin() {
+ QtUiSettings s;
+ s.setValue("MainWinSize", size());
+ s.setValue("MainWinPos", pos());
+ s.setValue("MainWinState", saveState());
+}
+
+void MainWin::setupMenus() {
+ connect(ui.actionConnectCore, SIGNAL(triggered()), this, SLOT(showCoreConnectionDlg()));
+ connect(ui.actionDisconnectCore, SIGNAL(triggered()), Client::instance(), SLOT(disconnectFromCore()));
+ connect(ui.actionQuit, SIGNAL(triggered()), QCoreApplication::instance(), SLOT(quit()));
+ //connect(ui.actionNetworkList, SIGNAL(triggered()), this, SLOT(showServerList()));
+ connect(ui.actionSettingsDlg, SIGNAL(triggered()), this, SLOT(showSettingsDlg()));
+ // connect(ui.actionDebug_Console, SIGNAL(triggered()), this, SLOT(showDebugConsole()));
+ connect(ui.actionAboutQuassel, SIGNAL(triggered()), this, SLOT(showAboutDlg()));
+ connect(ui.actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt()));
+
+ actionEditNetworks = new QAction(QIcon(":/22x22/actions/configure"), tr("Edit &Networks..."), this);
+ ui.menuNetworks->addAction(actionEditNetworks);
+ connect(actionEditNetworks, SIGNAL(triggered()), this, SLOT(showNetworkDlg()));
+ connect(ui.actionManageViews, SIGNAL(triggered()), this, SLOT(showManageViewsDlg()));
+}
+
+void MainWin::setupViews() {
+ QAction *separator = ui.menuViews->addSeparator();
+ separator->setData("__EOBV__");
+ addBufferView();
+}
+
+void MainWin::addBufferView(int bufferViewConfigId) {
+ addBufferView(Client::bufferViewManager()->bufferViewConfig(bufferViewConfigId));
+}
+
+void MainWin::addBufferView(BufferViewConfig *config) {
+ BufferViewDock *dock;
+ if(config)
+ dock = new BufferViewDock(config, this);
+ else
+ dock = new BufferViewDock(this);
+
+ //create the view and initialize it's filter
+ BufferView *view = new BufferView(dock);
+ view->setFilteredModel(Client::bufferModel(), config);
+ view->show();