Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | 356 | { | |||
---|---|---|---|---|---|
363 | file->addAction(KStandardAction::Open, q, SLOT(openFile())); | 363 | file->addAction(KStandardAction::Open, q, SLOT(openFile())); | ||
364 | mFileOpenRecentAction = KStandardAction::openRecent(q, SLOT(openUrl(QUrl)), q); | 364 | mFileOpenRecentAction = KStandardAction::openRecent(q, SLOT(openUrl(QUrl)), q); | ||
365 | file->addAction("file_open_recent", mFileOpenRecentAction); | 365 | file->addAction("file_open_recent", mFileOpenRecentAction); | ||
366 | file->addAction(KStandardAction::Print, q, SLOT(print())); | 366 | file->addAction(KStandardAction::Print, q, SLOT(print())); | ||
367 | file->addAction(KStandardAction::Quit, qApp, SLOT(closeAllWindows())); | 367 | file->addAction(KStandardAction::Quit, qApp, SLOT(closeAllWindows())); | ||
368 | 368 | | |||
369 | QAction * action = file->addAction("reload", q, SLOT(reload())); | 369 | QAction * action = file->addAction("reload", q, SLOT(reload())); | ||
370 | action->setText(i18nc("@action reload the currently viewed image", "Reload")); | 370 | action->setText(i18nc("@action reload the currently viewed image", "Reload")); | ||
371 | action->setIcon(QIcon::fromTheme("view-refresh")); | 371 | action->setIcon(QIcon::fromTheme("view-refresh-symbolic")); | ||
372 | actionCollection->setDefaultShortcuts(action, KStandardShortcut::reload()); | 372 | actionCollection->setDefaultShortcuts(action, KStandardShortcut::reload()); | ||
373 | 373 | | |||
374 | mBrowseAction = view->addAction("browse"); | 374 | mBrowseAction = view->addAction("browse"); | ||
375 | mBrowseAction->setText(i18nc("@action:intoolbar Switch to file list", "Browse")); | 375 | mBrowseAction->setText(i18nc("@action:intoolbar Switch to file list", "Browse")); | ||
376 | mBrowseAction->setToolTip(i18nc("@info:tooltip", "Browse folders for images")); | 376 | mBrowseAction->setToolTip(i18nc("@info:tooltip", "Browse folders for images")); | ||
377 | mBrowseAction->setCheckable(true); | 377 | mBrowseAction->setCheckable(true); | ||
378 | mBrowseAction->setIcon(QIcon::fromTheme("view-list-icons")); | 378 | mBrowseAction->setIcon(QIcon::fromTheme("view-list-icons")); | ||
379 | connect(mViewMainPage, SIGNAL(goToBrowseModeRequested()), | 379 | connect(mViewMainPage, SIGNAL(goToBrowseModeRequested()), | ||
380 | mBrowseAction, SLOT(trigger())); | 380 | mBrowseAction, SLOT(trigger())); | ||
381 | 381 | | |||
382 | mViewAction = view->addAction("view"); | 382 | mViewAction = view->addAction("view"); | ||
383 | mViewAction->setText(i18nc("@action:intoolbar Switch to image view", "View")); | 383 | mViewAction->setText(i18nc("@action:intoolbar Switch to image view", "View")); | ||
384 | mViewAction->setToolTip(i18nc("@info:tooltip", "View selected images")); | 384 | mViewAction->setToolTip(i18nc("@info:tooltip", "View selected images")); | ||
385 | mViewAction->setIcon(QIcon::fromTheme("view-preview")); | 385 | mViewAction->setIcon(QIcon::fromTheme("fileview-preview")); | ||
386 | mViewAction->setCheckable(true); | 386 | mViewAction->setCheckable(true); | ||
387 | 387 | | |||
388 | mViewModeActionGroup = new QActionGroup(q); | 388 | mViewModeActionGroup = new QActionGroup(q); | ||
389 | mViewModeActionGroup->addAction(mBrowseAction); | 389 | mViewModeActionGroup->addAction(mBrowseAction); | ||
390 | mViewModeActionGroup->addAction(mViewAction); | 390 | mViewModeActionGroup->addAction(mViewAction); | ||
391 | 391 | | |||
392 | connect(mViewModeActionGroup, SIGNAL(triggered(QAction*)), | 392 | connect(mViewModeActionGroup, SIGNAL(triggered(QAction*)), | ||
393 | q, SLOT(setActiveViewModeAction(QAction*))); | 393 | q, SLOT(setActiveViewModeAction(QAction*))); | ||
394 | 394 | | |||
395 | mFullScreenAction = static_cast<KToggleFullScreenAction*>(view->addAction(KStandardAction::FullScreen, q, SLOT(toggleFullScreen(bool)))); | 395 | mFullScreenAction = static_cast<KToggleFullScreenAction*>(view->addAction(KStandardAction::FullScreen, q, SLOT(toggleFullScreen(bool)))); | ||
396 | QList<QKeySequence> shortcuts = mFullScreenAction->shortcuts(); | 396 | QList<QKeySequence> shortcuts = mFullScreenAction->shortcuts(); | ||
397 | shortcuts.append(QKeySequence(Qt::Key_F11)); | 397 | shortcuts.append(QKeySequence(Qt::Key_F11)); | ||
398 | actionCollection->setDefaultShortcuts(mFullScreenAction, shortcuts); | 398 | actionCollection->setDefaultShortcuts(mFullScreenAction, shortcuts); | ||
399 | 399 | | |||
400 | connect(mViewMainPage, SIGNAL(toggleFullScreenRequested()), | 400 | connect(mViewMainPage, SIGNAL(toggleFullScreenRequested()), | ||
401 | mFullScreenAction, SLOT(trigger())); | 401 | mFullScreenAction, SLOT(trigger())); | ||
402 | 402 | | |||
403 | QAction * leaveFullScreenAction = view->addAction("leave_fullscreen", q, SLOT(leaveFullScreen())); | 403 | QAction * leaveFullScreenAction = view->addAction("leave_fullscreen", q, SLOT(leaveFullScreen())); | ||
404 | leaveFullScreenAction->setIcon(QIcon::fromTheme("view-restore")); | 404 | leaveFullScreenAction->setIcon(QIcon::fromTheme("view-restore-symbolic")); | ||
405 | leaveFullScreenAction->setPriority(QAction::LowPriority); | 405 | leaveFullScreenAction->setPriority(QAction::LowPriority); | ||
406 | leaveFullScreenAction->setText(i18nc("@action", "Leave Fullscreen Mode")); | 406 | leaveFullScreenAction->setText(i18nc("@action", "Leave Fullscreen Mode")); | ||
407 | 407 | | |||
408 | mGoToPreviousAction = view->addAction("go_previous", q, SLOT(goToPrevious())); | 408 | mGoToPreviousAction = view->addAction("go_previous", q, SLOT(goToPrevious())); | ||
409 | mGoToPreviousAction->setPriority(QAction::LowPriority); | 409 | mGoToPreviousAction->setPriority(QAction::LowPriority); | ||
410 | mGoToPreviousAction->setIcon(QIcon::fromTheme("media-skip-backward")); | 410 | mGoToPreviousAction->setIcon(QIcon::fromTheme("go-previous-symbolic")); | ||
411 | mGoToPreviousAction->setText(i18nc("@action Go to previous image", "Previous")); | 411 | mGoToPreviousAction->setText(i18nc("@action Go to previous image", "Previous")); | ||
412 | mGoToPreviousAction->setToolTip(i18nc("@info:tooltip", "Go to previous image")); | 412 | mGoToPreviousAction->setToolTip(i18nc("@info:tooltip", "Go to previous image")); | ||
413 | actionCollection->setDefaultShortcut(mGoToPreviousAction, Qt::Key_Backspace); | 413 | actionCollection->setDefaultShortcut(mGoToPreviousAction, Qt::Key_Backspace); | ||
414 | installDisabledActionShortcutMonitor(mGoToPreviousAction, SLOT(showFirstDocumentReached())); | 414 | installDisabledActionShortcutMonitor(mGoToPreviousAction, SLOT(showFirstDocumentReached())); | ||
415 | 415 | | |||
416 | mGoToNextAction = view->addAction("go_next", q, SLOT(goToNext())); | 416 | mGoToNextAction = view->addAction("go_next", q, SLOT(goToNext())); | ||
417 | mGoToNextAction->setPriority(QAction::LowPriority); | 417 | mGoToNextAction->setPriority(QAction::LowPriority); | ||
418 | mGoToNextAction->setIcon(QIcon::fromTheme("media-skip-forward")); | 418 | mGoToNextAction->setIcon(QIcon::fromTheme("go-next-symbolic")); | ||
419 | mGoToNextAction->setText(i18nc("@action Go to next image", "Next")); | 419 | mGoToNextAction->setText(i18nc("@action Go to next image", "Next")); | ||
420 | mGoToNextAction->setToolTip(i18nc("@info:tooltip", "Go to next image")); | 420 | mGoToNextAction->setToolTip(i18nc("@info:tooltip", "Go to next image")); | ||
421 | actionCollection->setDefaultShortcut(mGoToNextAction, Qt::Key_Space); | 421 | actionCollection->setDefaultShortcut(mGoToNextAction, Qt::Key_Space); | ||
422 | installDisabledActionShortcutMonitor(mGoToNextAction, SLOT(showLastDocumentReached())); | 422 | installDisabledActionShortcutMonitor(mGoToNextAction, SLOT(showLastDocumentReached())); | ||
423 | 423 | | |||
424 | mGoToFirstAction = view->addAction("go_first", q, SLOT(goToFirst())); | 424 | mGoToFirstAction = view->addAction("go_first", q, SLOT(goToFirst())); | ||
425 | mGoToFirstAction->setPriority(QAction::LowPriority); | 425 | mGoToFirstAction->setPriority(QAction::LowPriority); | ||
426 | mGoToFirstAction->setIcon(QIcon::fromTheme("go-first-symbolic")); | ||||
426 | mGoToFirstAction->setText(i18nc("@action Go to first image", "First")); | 427 | mGoToFirstAction->setText(i18nc("@action Go to first image", "First")); | ||
427 | mGoToFirstAction->setToolTip(i18nc("@info:tooltip", "Go to first image")); | 428 | mGoToFirstAction->setToolTip(i18nc("@info:tooltip", "Go to first image")); | ||
428 | actionCollection->setDefaultShortcut(mGoToFirstAction, Qt::Key_Home); | 429 | actionCollection->setDefaultShortcut(mGoToFirstAction, Qt::Key_Home); | ||
429 | 430 | | |||
430 | mGoToLastAction = view->addAction("go_last", q, SLOT(goToLast())); | 431 | mGoToLastAction = view->addAction("go_last", q, SLOT(goToLast())); | ||
431 | mGoToLastAction->setPriority(QAction::LowPriority); | 432 | mGoToLastAction->setPriority(QAction::LowPriority); | ||
433 | mGoToLastAction->setIcon(QIcon::fromTheme("go-last-symbolic")); | ||||
432 | mGoToLastAction->setText(i18nc("@action Go to last image", "Last")); | 434 | mGoToLastAction->setText(i18nc("@action Go to last image", "Last")); | ||
433 | mGoToLastAction->setToolTip(i18nc("@info:tooltip", "Go to last image")); | 435 | mGoToLastAction->setToolTip(i18nc("@info:tooltip", "Go to last image")); | ||
434 | actionCollection->setDefaultShortcut(mGoToLastAction, Qt::Key_End); | 436 | actionCollection->setDefaultShortcut(mGoToLastAction, Qt::Key_End); | ||
435 | 437 | | |||
436 | mPreloadDirectionIsForward = true; | 438 | mPreloadDirectionIsForward = true; | ||
437 | 439 | | |||
438 | mGoUpAction = view->addAction(KStandardAction::Up, q, SLOT(goUp())); | 440 | mGoUpAction = view->addAction(KStandardAction::Up, q, SLOT(goUp())); | ||
439 | 441 | | |||
440 | action = view->addAction("go_start_page", q, SLOT(showStartMainPage())); | 442 | action = view->addAction("go_start_page", q, SLOT(showStartMainPage())); | ||
441 | action->setPriority(QAction::LowPriority); | 443 | action->setPriority(QAction::LowPriority); | ||
442 | action->setIcon(QIcon::fromTheme("go-home")); | 444 | action->setIcon(QIcon::fromTheme("go-home-symbolic")); | ||
443 | action->setText(i18nc("@action", "Start Page")); | 445 | action->setText(i18nc("@action", "Start Page")); | ||
444 | action->setToolTip(i18nc("@info:tooltip", "Open the start page")); | 446 | action->setToolTip(i18nc("@info:tooltip", "Open the start page")); | ||
445 | 447 | | |||
446 | mToggleSideBarAction = view->add<KToggleAction>("toggle_sidebar"); | 448 | mToggleSideBarAction = view->add<KToggleAction>("toggle_sidebar"); | ||
447 | connect(mToggleSideBarAction, SIGNAL(toggled(bool)), | 449 | connect(mToggleSideBarAction, SIGNAL(toggled(bool)), | ||
448 | q, SLOT(toggleSideBar(bool))); | 450 | q, SLOT(toggleSideBar(bool))); | ||
449 | mToggleSideBarAction->setIcon(QIcon::fromTheme("view-sidetree")); | 451 | mToggleSideBarAction->setIcon(QIcon::fromTheme("view-sidetree")); | ||
450 | actionCollection->setDefaultShortcut(mToggleSideBarAction, Qt::Key_F4); | 452 | actionCollection->setDefaultShortcut(mToggleSideBarAction, Qt::Key_F4); | ||
Show All 36 Lines | 487 | { | |||
487 | // does the same as KUndoStack, but for the KUndoGroup actions. | 489 | // does the same as KUndoStack, but for the KUndoGroup actions. | ||
488 | QUndoGroup* undoGroup = DocumentFactory::instance()->undoGroup(); | 490 | QUndoGroup* undoGroup = DocumentFactory::instance()->undoGroup(); | ||
489 | QAction* action; | 491 | QAction* action; | ||
490 | KActionCollection* actionCollection = q->actionCollection(); | 492 | KActionCollection* actionCollection = q->actionCollection(); | ||
491 | KActionCategory* edit = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "Edit"), actionCollection); | 493 | KActionCategory* edit = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "Edit"), actionCollection); | ||
492 | 494 | | |||
493 | action = undoGroup->createRedoAction(actionCollection); | 495 | action = undoGroup->createRedoAction(actionCollection); | ||
494 | action->setObjectName(KStandardAction::name(KStandardAction::Redo)); | 496 | action->setObjectName(KStandardAction::name(KStandardAction::Redo)); | ||
495 | action->setIcon(QIcon::fromTheme("edit-redo")); | 497 | action->setIcon(QIcon::fromTheme("edit-redo-symbolic")); | ||
496 | action->setIconText(i18n("Redo")); | 498 | action->setIconText(i18n("Redo")); | ||
497 | actionCollection->setDefaultShortcuts(action, KStandardShortcut::redo()); | 499 | actionCollection->setDefaultShortcuts(action, KStandardShortcut::redo()); | ||
498 | 500 | | |||
499 | edit->addAction(action->objectName(), action); | 501 | edit->addAction(action->objectName(), action); | ||
500 | 502 | | |||
501 | action = undoGroup->createUndoAction(actionCollection); | 503 | action = undoGroup->createUndoAction(actionCollection); | ||
502 | action->setObjectName(KStandardAction::name(KStandardAction::Undo)); | 504 | action->setObjectName(KStandardAction::name(KStandardAction::Undo)); | ||
503 | action->setIcon(QIcon::fromTheme("edit-undo")); | 505 | action->setIcon(QIcon::fromTheme("edit-undo-symbolic")); | ||
504 | action->setIconText(i18n("Undo")); | 506 | action->setIconText(i18n("Undo")); | ||
505 | actionCollection->setDefaultShortcuts(action, KStandardShortcut::undo()); | 507 | actionCollection->setDefaultShortcuts(action, KStandardShortcut::undo()); | ||
506 | edit->addAction(action->objectName(), action); | 508 | edit->addAction(action->objectName(), action); | ||
507 | } | 509 | } | ||
508 | 510 | | |||
509 | void setupContextManagerItems() | 511 | void setupContextManagerItems() | ||
510 | { | 512 | { | ||
511 | Q_ASSERT(mContextManager); | 513 | Q_ASSERT(mContextManager); | ||
▲ Show 20 Lines • Show All 860 Lines • ▼ Show 20 Line(s) | 1348 | { | |||
1372 | } | 1374 | } | ||
1373 | updateSlideShowAction(); | 1375 | updateSlideShowAction(); | ||
1374 | } | 1376 | } | ||
1375 | 1377 | | |||
1376 | void MainWindow::updateSlideShowAction() | 1378 | void MainWindow::updateSlideShowAction() | ||
1377 | { | 1379 | { | ||
1378 | if (d->mSlideShow->isRunning()) { | 1380 | if (d->mSlideShow->isRunning()) { | ||
1379 | d->mToggleSlideShowAction->setText(i18n("Stop Slideshow")); | 1381 | d->mToggleSlideShowAction->setText(i18n("Stop Slideshow")); | ||
1380 | d->mToggleSlideShowAction->setIcon(QIcon::fromTheme("media-playback-pause")); | 1382 | d->mToggleSlideShowAction->setIcon(QIcon::fromTheme("media-playback-pause-symbolic")); | ||
1381 | } else { | 1383 | } else { | ||
1382 | d->mToggleSlideShowAction->setText(i18n("Start Slideshow")); | 1384 | d->mToggleSlideShowAction->setText(i18n("Start Slideshow")); | ||
1383 | d->mToggleSlideShowAction->setIcon(QIcon::fromTheme("media-playback-start")); | 1385 | d->mToggleSlideShowAction->setIcon(QIcon::fromTheme("media-playback-start-symbolic")); | ||
1384 | } | 1386 | } | ||
1385 | } | 1387 | } | ||
1386 | 1388 | | |||
1387 | bool MainWindow::queryClose() | 1389 | bool MainWindow::queryClose() | ||
1388 | { | 1390 | { | ||
1389 | saveConfig(); | 1391 | saveConfig(); | ||
1390 | d->saveSideBarConfig(); | 1392 | d->saveSideBarConfig(); | ||
1391 | QList<QUrl> list = DocumentFactory::instance()->modifiedDocumentList(); | 1393 | QList<QUrl> list = DocumentFactory::instance()->modifiedDocumentList(); | ||
1392 | if (list.size() == 0) { | 1394 | if (list.size() == 0) { | ||
1393 | return true; | 1395 | return true; | ||
1394 | } | 1396 | } | ||
1395 | 1397 | | |||
1396 | KGuiItem yes(i18n("Save All Changes"), "document-save-all"); | 1398 | KGuiItem yes(i18n("Save All Changes"), "document-save-symbolic"); | ||
1397 | KGuiItem no(i18n("Discard Changes")); | 1399 | KGuiItem no(i18n("Discard Changes"), "user-trash-symbolic"); | ||
1398 | QString msg = i18np("One image has been modified.", "%1 images have been modified.", list.size()) | 1400 | QString msg = i18np("One image has been modified.", "%1 images have been modified.", list.size()) | ||
1399 | + '\n' | 1401 | + '\n' | ||
1400 | + i18n("If you quit now, your changes will be lost."); | 1402 | + i18n("If you quit now, your changes will be lost."); | ||
1401 | int answer = KMessageBox::warningYesNoCancel( | 1403 | int answer = KMessageBox::warningYesNoCancel( | ||
1402 | this, | 1404 | this, | ||
1403 | msg, | 1405 | msg, | ||
1404 | QString() /* caption */, | 1406 | QString() /* caption */, | ||
1405 | yes, | 1407 | yes, | ||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |