X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtopia%2Fqtopiamainwin.cpp;h=63880587b78be978ca3f4f6ddf4e215027089d48;hp=e58ef1b0d6e39946f5a021c092c1c6d61f747bfc;hb=f6f6f3e368543f0a4dce1dae772f161d7e357064;hpb=d47cd9b56ba10dc6e20baeabbd2b51305824b8c2 diff --git a/src/qtopia/qtopiamainwin.cpp b/src/qtopia/qtopiamainwin.cpp index e58ef1b0..63880587 100644 --- a/src/qtopia/qtopiamainwin.cpp +++ b/src/qtopia/qtopiamainwin.cpp @@ -5,7 +5,7 @@ * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -20,7 +20,7 @@ #include "qtopiamainwin.h" -#include "buffertreemodel.h" +#include "networkmodel.h" #include "bufferviewwidget.h" #include "nicklistwidget.h" #include "chatline.h" @@ -31,11 +31,11 @@ #include "qtopiaui.h" #include "signalproxy.h" +#include "ui_aboutdlg.h" + #include #include -#define DEBUGMODE - // This constructor is the first thing to be called for a Qtopia app, so we do the init stuff // here (rather than in a main.cpp). QtopiaMainWin::QtopiaMainWin(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { @@ -62,11 +62,12 @@ QtopiaMainWin::QtopiaMainWin(QWidget *parent, Qt::WFlags flags) : QMainWindow(pa mainWidget = new MainWidget(this); setCentralWidget(mainWidget); - BufferTreeModel *model = Client::bufferModel(); + NetworkModel *model = Client::networkModel(); connect(model, SIGNAL(bufferSelected(Buffer *)), this, SLOT(showBuffer(Buffer *))); toolBar = new QToolBar(this); toolBar->setIconSize(QSize(16, 16)); + toolBar->setWindowTitle(tr("Show Toolbar")); addToolBar(toolBar); bufferViewWidget = new BufferViewWidget(this); @@ -96,7 +97,7 @@ QtopiaMainWin::~QtopiaMainWin() { } void QtopiaMainWin::closeEvent(QCloseEvent *event) { -#ifndef DEBUGMODE +#ifndef DEVELMODE QMessageBox *box = new QMessageBox(QMessageBox::Question, tr("Quit Quassel IRC?"), tr("Do you really want to quit Quassel IRC?"), QMessageBox::Cancel, this); QAbstractButton *quit = box->addButton(tr("Quit"), QMessageBox::AcceptRole); @@ -110,12 +111,18 @@ void QtopiaMainWin::closeEvent(QCloseEvent *event) { } void QtopiaMainWin::setupActions() { - showBuffersAction = toolBar->addAction(QIcon(":icon/options-hide"), "Show Buffers", this, SLOT(showBufferView())); // FIXME provide real icon - showNicksAction = toolBar->addAction(QIcon(":icon/list"), "Show Nicks", this, SLOT(showNickList())); + showBuffersAction = toolBar->addAction(QIcon(":icon/options-hide"), tr("Show Buffers"), this, SLOT(showBufferView())); // FIXME provide real icon + showNicksAction = toolBar->addAction(QIcon(":icon/list"), tr("Show Nicks"), this, SLOT(showNickList())); + showNicksAction->setEnabled(false); QMenu *menu = new QMenu(this); menu->addAction(showBuffersAction); menu->addAction(showNicksAction); + menu->addSeparator(); + menu->addAction(toolBar->toggleViewAction()); + menu->addSeparator(); + menu->addAction(tr("About..."), this, SLOT(showAboutDlg())); + QSoftMenuBar::addMenuTo(this, menu); } @@ -124,11 +131,11 @@ void QtopiaMainWin::connectedToCore() { emit requestBacklog(id, 100, -1); } -#ifdef DEBUGMODE +#ifdef DEVELMODE // FIXME just for testing: select first available buffer if(Client::allBufferInfos().count() > 1) { Buffer *b = Client::buffer(Client::allBufferInfos()[1]); - Client::bufferModel()->selectBuffer(b); + Client::networkModel()->selectBuffer(b); } #endif } @@ -144,19 +151,26 @@ AbstractUiMsg *QtopiaMainWin::layoutMsg(const Message &msg) { } void QtopiaMainWin::showBuffer(Buffer *b) { - mainWidget->setBuffer(b); bufferViewWidget->hide(); + mainWidget->setBuffer(b); nickListWidget->setBuffer(b); + showNicksAction->setEnabled(b && b->bufferType() == Buffer::ChannelType); } void QtopiaMainWin::showBufferView() { bufferViewWidget->showMaximized(); - } void QtopiaMainWin::showNickList() { nickListWidget->showMaximized(); } +void QtopiaMainWin::showAboutDlg() { + QDialog *dlg = new QDialog(this); + dlg->setAttribute(Qt::WA_DeleteOnClose); + Ui::AboutDlg ui; + ui.setupUi(dlg); + dlg->showMaximized(); +}