X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=78f8d3831c1ef67d37245bb4b61cad025bba7586;hp=4957c90c434769b5b71130503526d13a38c60f30;hb=236dda81632fa792e788d45b0f4f31b973823f7f;hpb=c45a002f4e8d5a1faa9fb6804e85d875862210db diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 4957c90c..78f8d383 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -116,20 +116,6 @@ MainWin::MainWin(QWidget *parent) installEventFilter(new JumpKeyHandler(this)); -#ifndef HAVE_KDE - QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this)); - QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); -# ifdef HAVE_PHONON - QtUi::registerNotificationBackend(new PhononNotificationBackend(this)); -# endif -# ifdef HAVE_DBUS - QtUi::registerNotificationBackend(new DesktopNotificationBackend(this)); -# endif - -#else /* HAVE_KDE */ - QtUi::registerNotificationBackend(new KNotificationBackend(this)); -#endif /* HAVE_KDE */ - QtUiApplication* app = qobject_cast qApp; connect(app, SIGNAL(saveStateToSession(const QString&)), SLOT(saveStateToSession(const QString&))); connect(app, SIGNAL(saveStateToSessionSettings(SessionSettings&)), SLOT(saveStateToSessionSettings(SessionSettings&))); @@ -158,7 +144,6 @@ void MainWin::init() { setupActions(); setupBufferWidget(); setupMenus(); - setupViews(); setupTopicWidget(); setupChatMonitor(); setupNickWidget(); @@ -167,6 +152,20 @@ void MainWin::init() { setupSystray(); setupTitleSetter(); +#ifndef HAVE_KDE + QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this)); + QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); +# ifdef HAVE_PHONON + QtUi::registerNotificationBackend(new PhononNotificationBackend(this)); +# endif +# ifdef HAVE_DBUS + QtUi::registerNotificationBackend(new DesktopNotificationBackend(this)); +# endif + +#else /* HAVE_KDE */ + QtUi::registerNotificationBackend(new KNotificationBackend(this)); +#endif /* HAVE_KDE */ + // restore mainwin state restoreState(s.value("MainWinState").toByteArray()); @@ -303,24 +302,20 @@ void MainWin::setupBufferWidget() { setCentralWidget(_bufferWidget); } -void MainWin::setupViews() { - 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); + if(!config) + return; + + BufferViewDock *dock = new BufferViewDock(config, this); //create the view and initialize it's filter BufferView *view = new BufferView(dock); view->setFilteredModel(Client::bufferModel(), config); + view->installEventFilter(_inputWidget->inputLine()); // for key presses view->show(); Client::bufferModel()->synchronizeView(view); @@ -420,20 +415,20 @@ void MainWin::setupInputWidget() { VerticalDock *dock = new VerticalDock(tr("Inputline"), this); dock->setObjectName("InputDock"); - InputWidget *inputWidget = new InputWidget(dock); - dock->setWidget(inputWidget); + _inputWidget = new InputWidget(dock); + dock->setWidget(_inputWidget); addDockWidget(Qt::BottomDockWidgetArea, dock); _viewMenu->addAction(dock->toggleViewAction()); dock->toggleViewAction()->setText(tr("Show Input Line")); - inputWidget->setModel(Client::bufferModel()); - inputWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel()); + _inputWidget->setModel(Client::bufferModel()); + _inputWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel()); - _bufferWidget->setFocusProxy(inputWidget); + _bufferWidget->setFocusProxy(_inputWidget); - inputWidget->inputLine()->installEventFilter(_bufferWidget); + _inputWidget->inputLine()->installEventFilter(_bufferWidget); } void MainWin::setupTopicWidget() { @@ -463,13 +458,12 @@ void MainWin::setupStatusBar() { connect(Client::messageProcessor(), SIGNAL(progressUpdated(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int))); // Core Lag: - updateLagIndicator(0); + updateLagIndicator(); statusBar()->addPermanentWidget(coreLagLabel); coreLagLabel->hide(); connect(Client::signalProxy(), SIGNAL(lagUpdated(int)), this, SLOT(updateLagIndicator(int))); // SSL indicator - connect(Client::instance(), SIGNAL(securedConnection()), this, SLOT(securedConnection())); sslLabel->setPixmap(QPixmap()); statusBar()->addPermanentWidget(sslLabel); sslLabel->hide(); @@ -558,8 +552,11 @@ void MainWin::setConnectedState() { if(!Client::internalCore()) statusBar()->showMessage(tr("Connected to core.")); - if(sslLabel->width() == 0) + if(Client::signalProxy()->isSecure()) { + sslLabel->setPixmap(SmallIcon("security-high")); + } else { sslLabel->setPixmap(SmallIcon("security-low")); + } sslLabel->setVisible(!Client::internalCore()); coreLagLabel->setVisible(!Client::internalCore()); @@ -579,13 +576,12 @@ void MainWin::saveLayout() { } void MainWin::updateLagIndicator(int lag) { - coreLagLabel->setText(QString(tr("Core Lag: %1 msec")).arg(lag)); -} - - -void MainWin::securedConnection() { - // todo: make status bar entry - sslLabel->setPixmap(SmallIcon("security-high")); + QString text = tr("Core Lag: %1"); + if(lag == -1) + text = text.arg('-'); + else + text = text.arg("%1 msec").arg(lag); + coreLagLabel->setText(text); } void MainWin::disconnectedFromCore() { @@ -619,6 +615,7 @@ void MainWin::setDisconnectedState() { statusBar()->showMessage(tr("Not connected to core.")); sslLabel->setPixmap(QPixmap()); sslLabel->hide(); + updateLagIndicator(); coreLagLabel->hide(); updateIcon(); }