1 /***************************************************************************
2 * Copyright (C) 2005 by The Quassel Team *
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) any later version. *
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 ***************************************************************************/
27 #include "channelwidget.h"
28 #include "serverlist.h"
29 #include "coreconnectdlg.h"
31 MainWin::MainWin() : QMainWindow() {
34 setWindowTitle("Quassel IRC");
35 setWindowIcon(QIcon(":/qirc-icon.png"));
36 setWindowIconText("Quassel IRC");
39 s.beginGroup("Geometry");
40 resize(s.value("MainWinSize", QSize(500, 400)).toSize());
41 move(s.value("MainWinPos", QPoint(50, 50)).toPoint());
44 //workspace = new QWorkspace(this);
45 //setCentralWidget(workspace);
46 statusBar()->showMessage(tr("Waiting for core..."));
51 serverListDlg = new ServerListDlg(this);
52 serverListDlg->setVisible(serverListDlg->showOnStartup());
54 //identitiesAct = settingsMenu->addAction(QIcon(":/default/identity.png"), tr("&Identities..."), serverListDlg, SLOT(editIdentities()));
56 IrcWidget *cw = new IrcWidget(this);
58 //workspace->addWindow(cw);
59 //cw->showMaximized();
60 statusBar()->showMessage(tr("Ready."));
64 void MainWin::setupMenus() {
65 connect(ui.actionNetworkList, SIGNAL(activated()), this, SLOT(showServerList()));
66 connect(ui.actionEditIdentities, SIGNAL(activated()), serverListDlg, SLOT(editIdentities()));
69 void MainWin::syncToCore() {
70 if(global->getData("CoreReady").toBool()) return;
71 // ok, apparently we are running as standalone GUI
72 coreConnectDlg = new CoreConnectDlg(this);
73 if(coreConnectDlg->exec() != QDialog::Accepted) {
77 VarMap state = coreConnectDlg->getCoreState().toMap()["CoreData"].toMap();
78 delete coreConnectDlg;
80 foreach(key, state.keys()) {
81 global->updateData(key, state[key]);
83 if(!global->getData("CoreReady").toBool()) {
84 QMessageBox::critical(this, tr("Fatal Error"), tr("<b>Could not synchronize with Quassel Core!</b><br>Quassel GUI will be aborted."), QMessageBox::Abort);
90 void MainWin::showServerList() {
91 // if(!serverListDlg) {
92 // serverListDlg = new ServerListDlg(this);
94 serverListDlg->show();
97 void MainWin::closeEvent(QCloseEvent *event)
99 //if (userReallyWantsToQuit()) {
101 s.beginGroup("Geometry");
102 s.setValue("MainWinSize", size());
103 s.setValue("MainWinPos", pos());