Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show All 27 Lines | |||||
28 | #include <QShortcut> | 28 | #include <QShortcut> | ||
29 | #include <QSplitter> | 29 | #include <QSplitter> | ||
30 | #include <QStackedWidget> | 30 | #include <QStackedWidget> | ||
31 | #include <QTimer> | 31 | #include <QTimer> | ||
32 | #include <QUndoGroup> | 32 | #include <QUndoGroup> | ||
33 | #include <QVBoxLayout> | 33 | #include <QVBoxLayout> | ||
34 | #include <QMenuBar> | 34 | #include <QMenuBar> | ||
35 | #include <QUrl> | 35 | #include <QUrl> | ||
36 | #include <QMouseEvent> | ||||
36 | #ifdef Q_OS_OSX | 37 | #ifdef Q_OS_OSX | ||
37 | #include <QFileOpenEvent> | 38 | #include <QFileOpenEvent> | ||
38 | #endif | 39 | #endif | ||
39 | 40 | | |||
40 | // KDE | 41 | // KDE | ||
41 | #include <KActionCategory> | 42 | #include <KActionCategory> | ||
42 | #include <KActionCollection> | 43 | #include <KActionCollection> | ||
43 | #include <QFileDialog> | 44 | #include <QFileDialog> | ||
▲ Show 20 Lines • Show All 921 Lines • ▼ Show 20 Line(s) | 962 | if (!d->mViewMainPage->isEmpty() | |||
965 | // gwenview http://example.com/example.png | 966 | // gwenview http://example.com/example.png | ||
966 | // and switch to browse mode, switching back to view mode won't bring | 967 | // and switch to browse mode, switching back to view mode won't bring | ||
967 | // his image back. | 968 | // his image back. | ||
968 | d->mViewMainPage->reset(); | 969 | d->mViewMainPage->reset(); | ||
969 | } | 970 | } | ||
970 | setCaption(QString()); | 971 | setCaption(QString()); | ||
971 | } | 972 | } | ||
972 | d->autoAssignThumbnailProvider(); | 973 | d->autoAssignThumbnailProvider(); | ||
973 | toggleSideBar(d->sideBarVisibility()); | 974 | toggleSideBar(d->sideBarVisibility()); | ||
rkflx: Unrelated whitespace change, please revert. | |||||
974 | toggleStatusBar(d->statusBarVisibility()); | 975 | toggleStatusBar(d->statusBarVisibility()); | ||
975 | 976 | | |||
976 | emit viewModeChanged(); | 977 | emit viewModeChanged(); | ||
977 | } | 978 | } | ||
978 | 979 | | |||
979 | void MainWindow::slotThumbnailViewIndexActivated(const QModelIndex& index) | 980 | void MainWindow::slotThumbnailViewIndexActivated(const QModelIndex& index) | ||
980 | { | 981 | { | ||
981 | if (!index.isValid()) { | 982 | if (!index.isValid()) { | ||
▲ Show 20 Lines • Show All 519 Lines • ▼ Show 20 Line(s) | 1501 | default: // cancel | |||
1501 | return false; | 1502 | return false; | ||
1502 | } | 1503 | } | ||
1503 | } | 1504 | } | ||
1504 | 1505 | | |||
1505 | void MainWindow::showConfigDialog() | 1506 | void MainWindow::showConfigDialog() | ||
1506 | { | 1507 | { | ||
1507 | // Save first so changes like thumbnail zoom level are not lost when reloading config | 1508 | // Save first so changes like thumbnail zoom level are not lost when reloading config | ||
1508 | saveConfig(); | 1509 | saveConfig(); | ||
1509 | 1510 | | |||
rkflx: Unrelated whitespace change, please revert. | |||||
1510 | DialogGuard<ConfigDialog> dialog(this); | 1511 | DialogGuard<ConfigDialog> dialog(this); | ||
1511 | connect(dialog.data(), SIGNAL(settingsChanged(QString)), SLOT(loadConfig())); | 1512 | connect(dialog.data(), SIGNAL(settingsChanged(QString)), SLOT(loadConfig())); | ||
1512 | dialog->exec(); | 1513 | dialog->exec(); | ||
1513 | } | 1514 | } | ||
1514 | 1515 | | |||
1515 | void MainWindow::configureShortcuts() | 1516 | void MainWindow::configureShortcuts() | ||
1516 | { | 1517 | { | ||
1517 | guiFactory()->configureShortcuts(); | 1518 | guiFactory()->configureShortcuts(); | ||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | 1649 | if (event->type() == QEvent::FileOpen) { | |||
1649 | QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent*>(event); | 1650 | QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent*>(event); | ||
1650 | openUrl(fileOpenEvent->url()); | 1651 | openUrl(fileOpenEvent->url()); | ||
1651 | return true; | 1652 | return true; | ||
1652 | } | 1653 | } | ||
1653 | #endif | 1654 | #endif | ||
1654 | return false; | 1655 | return false; | ||
1655 | } | 1656 | } | ||
1656 | 1657 | | |||
1658 | void MainWindow::mousePressEvent(QMouseEvent *event) | ||||
1659 | { | ||||
1660 | mouseButtonNavigate(event); | ||||
1661 | KXmlGuiWindow::mousePressEvent(event); | ||||
1662 | } | ||||
1663 | | ||||
1664 | void MainWindow::mouseDoubleClickEvent(QMouseEvent *event) | ||||
1665 | { | ||||
1666 | mouseButtonNavigate(event); | ||||
1667 | KXmlGuiWindow::mouseDoubleClickEvent(event); | ||||
1668 | } | ||||
1669 | | ||||
1670 | void MainWindow::mouseButtonNavigate(QMouseEvent *event) | ||||
1671 | { | ||||
1672 | switch(event->button()) { | ||||
1673 | case Qt::ForwardButton: | ||||
1674 | if (d->mGoToNextAction->isEnabled()) { | ||||
1675 | d->mGoToNextAction->trigger(); | ||||
1676 | return; | ||||
1677 | } | ||||
1678 | break; | ||||
1679 | case Qt::BackButton: | ||||
1680 | if (d->mGoToPreviousAction->isEnabled()) { | ||||
1681 | d->mGoToPreviousAction->trigger(); | ||||
1682 | return; | ||||
1683 | } | ||||
1684 | break; | ||||
1685 | default: ; | ||||
1686 | } | ||||
1687 | } | ||||
1688 | | ||||
1657 | void MainWindow::setDistractionFreeMode(bool value) | 1689 | void MainWindow::setDistractionFreeMode(bool value) | ||
1658 | { | 1690 | { | ||
1659 | d->mFullScreenContent->setDistractionFreeMode(value); | 1691 | d->mFullScreenContent->setDistractionFreeMode(value); | ||
1660 | } | 1692 | } | ||
1661 | 1693 | | |||
1662 | void MainWindow::saveProperties(KConfigGroup& group) | 1694 | void MainWindow::saveProperties(KConfigGroup& group) | ||
1663 | { | 1695 | { | ||
1664 | group.writeEntry(SESSION_CURRENT_PAGE_KEY, int(d->mCurrentMainPageId)); | 1696 | group.writeEntry(SESSION_CURRENT_PAGE_KEY, int(d->mCurrentMainPageId)); | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |
Unrelated whitespace change, please revert.