~ubuntu-branches/ubuntu/trusty/quassel/trusty-updates

« back to all changes in this revision

Viewing changes to src/qtui/mainwin.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-18 23:18:25 UTC
  • mfrom: (1.1.54)
  • Revision ID: package-import@ubuntu.com-20140218231825-6vvoh451otn95pkn
Tags: 0.10~beta1-0ubuntu1
* New upstream beta relase
  - Drop debian/patches/upstream_fix_fullscreen_mode.diff which had been
    cherrypicked from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2005-2013 by the Quassel Project                        *
 
2
 *   Copyright (C) 2005-2014 by the Quassel Project                        *
3
3
 *   devel@quassel-irc.org                                                 *
4
4
 *                                                                         *
5
5
 *   This program is free software; you can redistribute it and/or modify  *
62
62
#include "clientbufferviewconfig.h"
63
63
#include "clientbufferviewmanager.h"
64
64
#include "clientignorelistmanager.h"
 
65
#include "clienttransfer.h"
 
66
#include "clienttransfermanager.h"
65
67
#include "coreconfigwizard.h"
66
68
#include "coreconnectdlg.h"
67
69
#include "coreconnection.h"
83
85
#include "qtuimessageprocessor.h"
84
86
#include "qtuisettings.h"
85
87
#include "qtuistyle.h"
 
88
#include "receivefiledlg.h"
86
89
#include "settingsdlg.h"
87
90
#include "settingspagedlg.h"
88
91
#include "statusnotifieritem.h"
94
97
#  ifdef HAVE_PHONON
95
98
#    include "phononnotificationbackend.h"
96
99
#  endif
 
100
#  ifdef HAVE_LIBSNORE
 
101
#    include "snorenotificationbackend.h"
 
102
#  endif
97
103
#  include "systraynotificationbackend.h"
98
104
#  include "taskbarnotificationbackend.h"
99
105
#else /* HAVE_KDE */
212
218
#  ifdef HAVE_PHONON
213
219
    QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
214
220
#  endif
215
 
#  ifndef QT_NO_SYSTEMTRAYICON
 
221
#  ifdef HAVE_LIBSNORE
 
222
    QtUi::registerNotificationBackend(new SnoreNotificationBackend(this));
 
223
#  elif !defined(QT_NO_SYSTEMTRAYICON)
216
224
    QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
217
225
#  endif
218
226
 
652
660
 
653
661
void MainWin::bufferViewToggled(bool enabled)
654
662
{
655
 
    if (!enabled && !isVisible()) {
 
663
    if (!enabled && !isMinimized()) {
656
664
        // hiding the mainwindow triggers a toggle of the bufferview (which pretty much sucks big time)
657
665
        // since this isn't our fault and we can't do anything about it, we suppress the resulting calls
658
666
        return;
1007
1015
 
1008
1016
    QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar);
1009
1017
    _toolbarMenu->addAction(_mainToolBar->toggleViewAction());
1010
 
}
 
1018
 
 
1019
#ifdef Q_WS_MAC
 
1020
    QtUiSettings uiSettings;
 
1021
 
 
1022
    bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool();
 
1023
    _mainToolBar->setVisible(visible);
 
1024
    connect(_mainToolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveMainToolBarStatus(bool)));
 
1025
#endif
 
1026
}
 
1027
 
 
1028
#ifdef Q_WS_MAC
 
1029
void MainWin::saveMainToolBarStatus(bool enabled)
 
1030
{
 
1031
    QtUiSettings uiSettings;
 
1032
    uiSettings.setValue("ShowMainToolBar", enabled);
 
1033
}
 
1034
#endif
1011
1035
 
1012
1036
 
1013
1037
void MainWin::connectedToCore()
1017
1041
    connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
1018
1042
    connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
1019
1043
 
 
1044
    connect(Client::transferManager(), SIGNAL(transferAdded(const ClientTransfer*)), SLOT(showNewTransferDlg(const ClientTransfer*)));
 
1045
 
1020
1046
    setConnectedState();
1021
1047
}
1022
1048
 
1353
1379
}
1354
1380
 
1355
1381
 
 
1382
void MainWin::showNewTransferDlg(const ClientTransfer *transfer)
 
1383
{
 
1384
    ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this);
 
1385
    dlg->show();
 
1386
}
 
1387
 
 
1388
 
1356
1389
void MainWin::onFullScreenToggled()
1357
1390
{
1358
1391
    // Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs
1378
1411
 
1379
1412
bool MainWin::event(QEvent *event)
1380
1413
{
1381
 
    if (event->type() == QEvent::WindowActivate) {
1382
 
        BufferId buffer = Client::bufferModel()->currentBuffer();
1383
 
        if (buffer.isValid())
1384
 
            Client::instance()->markBufferAsRead(buffer);
 
1414
    switch(event->type()) {
 
1415
    case QEvent::WindowActivate: {
 
1416
        BufferId bufferId = Client::bufferModel()->currentBuffer();
 
1417
        if (bufferId.isValid())
 
1418
            Client::instance()->markBufferAsRead(bufferId);
 
1419
        break;
 
1420
    }
 
1421
    case QEvent::WindowDeactivate:
 
1422
        if (bufferWidget()->autoMarkerLineOnLostFocus())
 
1423
            bufferWidget()->setMarkerLine();
 
1424
        break;
 
1425
    default:
 
1426
        break;
1385
1427
    }
1386
1428
    return QMainWindow::event(event);
1387
1429
}