BibleTime
bibletime_init.cpp
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#include "bibletime.h"
14
15#include <QActionGroup>
16#include <QDebug>
17#include <QDockWidget>
18#include <QMdiSubWindow>
19#include <QMenu>
20#include <QMenuBar>
21#include <QPointer>
22#include <QSplitter>
23#include <QToolBar>
24#include <QToolButton>
25#include <QVBoxLayout>
26#include "../backend/config/btconfig.h"
27#include "../util/btassert.h"
28#include "../util/btconnect.h"
29#include "../util/cresmgr.h"
30#include "bibletimeapp.h"
32#include "btopenworkaction.h"
33#include "cinfodisplay.h"
34#include "cmdiarea.h"
39
40// Sword includes:
41#include <swmgr.h>
42
43
44using namespace InfoDisplay;
45
47 QAction * const showBookshelfAction,
48 QAction * const showBookmarksAction,
49 QAction * const showMagAction,
50 QObject * const parent)
51 : BtActionCollection(parent)
52{
53 // File menu:
54
55 file.openWork =
57 btConfig(),
58 QStringLiteral("GUI/mainWindow/openWorkAction/grouping"),
59 this);
60
61 file.quit = new QAction(this);
62 file.quit->setIcon(CResMgr::mainMenu::file::quit::icon());
63 file.quit->setMenuRole(QAction::QuitRole);
64 file.quit->setShortcut(tr("Ctrl+Q", "File|Quit"));
65 addAction(QStringLiteral("quit"), file.quit);
66
67 // View menu:
68
69 view.fullscreen = new QAction(this);
70 view.fullscreen->setCheckable(true);
71 view.fullscreen->setIcon(CResMgr::mainMenu::view::showFullscreen::icon());
72 view.fullscreen->setShortcut(tr("F11", "View|Full screen"));
73 addAction(QStringLiteral("toggleFullscreen"), view.fullscreen);
74
75 view.showBookshelf = showBookshelfAction;
76 view.showBookshelf->setIcon(CResMgr::mainMenu::view::showBookshelf::icon());
77 addAction(QStringLiteral("showBookshelf"), view.showBookshelf);
78
79 view.showBookmarks = showBookmarksAction;
80 view.showBookmarks->setIcon(CResMgr::mainMenu::view::showBookmarks::icon());
81 addAction(QStringLiteral("showBookmarks"), view.showBookmarks);
82
83 view.showMag = showMagAction;
84 view.showMag->setIcon(CResMgr::mainMenu::view::showMag::icon());
85 view.showMag->setShortcut(tr("F8", "View|Show mag"));
86 addAction(QStringLiteral("showMag"), view.showMag);
87
88 view.showParallelTextHeadings = new QAction(this);
89 view.showParallelTextHeadings->setCheckable(true);
90 addAction(QStringLiteral("showParallelTextHeaders"),
91 view.showParallelTextHeadings);
92
93 view.toolbars.showMainToolbar = new QAction(this);
94 view.toolbars.showMainToolbar->setCheckable(true);
95 view.toolbars.showMainToolbar->setShortcut(
96 tr("F6", "View|Show main toolbar"));
97 addAction(QStringLiteral("showToolbar"), view.toolbars.showMainToolbar);
98
99 view.toolbars.showNavigationToolbar = new QAction(this);
100 view.toolbars.showNavigationToolbar->setCheckable(true);
101 addAction(QStringLiteral("showNavigation"),
102 view.toolbars.showNavigationToolbar);
103
104 view.toolbars.showWorksToolbar = new QAction(this);
105 view.toolbars.showWorksToolbar->setCheckable(true);
106 addAction(QStringLiteral("showWorks"), view.toolbars.showWorksToolbar);
107
108 view.toolbars.showToolsToolbar = new QAction(this);
109 view.toolbars.showToolsToolbar->setCheckable(true);
110 addAction(QStringLiteral("showTools"), view.toolbars.showToolsToolbar);
111
112 view.toolbars.showToolbarsInTextWindows = new QAction(this);
113 view.toolbars.showToolbarsInTextWindows->setCheckable(true);
114 addAction(QStringLiteral("showToolbarsInTextWindows"),
115 view.toolbars.showToolbarsInTextWindows);
116
117 view.scroll.autoScrollUp = new QAction(this);
118 view.scroll.autoScrollUp->setShortcut(
119 tr("Shift+Up", "View|Scroll|Auto scroll up"));
120 addAction(QStringLiteral("autoScrollUp"), view.scroll.autoScrollUp);
121
122 view.scroll.autoScrollDown = new QAction(this);
123 view.scroll.autoScrollDown->setShortcut(
124 tr("Shift+Down", "View|Scroll|Auto scroll down"));
125 addAction(QStringLiteral("autoScrollDown"), view.scroll.autoScrollDown);
126
127 view.scroll.pauseAutoScroll = new QAction(this);
128 view.scroll.pauseAutoScroll->setDisabled(true);
129 view.scroll.pauseAutoScroll->setShortcut(
130 tr("Space", "View|Scroll|Auto scroll pause"));
131 addAction(QStringLiteral("autoScrollPause"), view.scroll.pauseAutoScroll);
132
133 // Search menu:
134
135 search.searchOpenWorks = new QAction(this);
136 search.searchOpenWorks->setIcon(
137 CResMgr::mainMenu::mainIndex::search::icon());
138 search.searchOpenWorks->setShortcut(
139 tr("Ctrl+O", "Search|Search in open works"));
140 addAction(QStringLiteral("searchOpenWorks"), search.searchOpenWorks);
141
142 search.searchStandardBible = new QAction(this);
143 search.searchStandardBible->setIcon(
144 CResMgr::mainMenu::mainIndex::searchdefaultbible::icon());
145 search.searchStandardBible->setShortcut(
146 tr("Ctrl+Alt+F", "Search|Search in the default Bible"));
147 addAction(QStringLiteral("searchStdBible"), search.searchStandardBible);
148
149 // Windows menu:
150
151 windows.closeWindow = new QAction(this);
152 windows.closeWindow->setIcon(CResMgr::mainMenu::window::close::icon());
153 windows.closeWindow->setShortcut(tr("Ctrl+W", "Windows|Close window"));
154 addAction(QStringLiteral("closeWindow"), windows.closeWindow);
155
156 windows.closeAllWindows = new QAction(this);
157 windows.closeAllWindows->setIcon(
158 CResMgr::mainMenu::window::closeAll::icon());
159 windows.closeAllWindows->setShortcut(
160 tr("Ctrl+Alt+W", "Windows|Close all windows"));
161 addAction(QStringLiteral("closeAllWindows"), windows.closeAllWindows);
162
163 windows.tileVertically = new QAction(this);
164 windows.tileVertically->setIcon(
165 CResMgr::mainMenu::window::tileVertical::icon());
166 windows.tileVertically->setShortcut(
167 tr("Ctrl+G", "Windows|Tile vertically"));
168 addAction(QStringLiteral("tileVertically"), windows.tileVertically);
169
170 windows.tileHorizontally = new QAction(this);
171 windows.tileHorizontally->setIcon(
172 CResMgr::mainMenu::window::tileHorizontal::icon());
173 windows.tileHorizontally->setShortcut(
174 tr("Ctrl+H", "Windows|Tile horizontally"));
175 addAction(QStringLiteral("tileHorizontally"), windows.tileHorizontally);
176
177 windows.tile = new QAction(this);
178 windows.tile->setIcon(CResMgr::mainMenu::window::tile::icon());
179 windows.tile->setShortcut(tr("Ctrl+I", "Windows|Tile"));
180 addAction(QStringLiteral("tile"), windows.tile);
181
182 windows.cascade = new QAction(this);
183 windows.cascade->setIcon(CResMgr::mainMenu::window::cascade::icon());
184 windows.cascade->setShortcut(tr("Ctrl+J", "Windows|Cascade"));
185 addAction(QStringLiteral("cascade"), windows.cascade);
186
188
189 windows.arrangementMode.manual = new QAction(this);
190 windows.arrangementMode.manual->setCheckable(true);
191 windows.arrangementMode.manual->setIcon(AM::manual::icon());
192 windows.arrangementMode.manual->setShortcut(
193 tr("Ctrl+Alt+M", "Windows|Arrangement mode|Manual"));
194 addAction(QStringLiteral("manualArrangement"),
195 windows.arrangementMode.manual);
196
197 windows.arrangementMode.tabbed = new QAction(this);
198 windows.arrangementMode.tabbed->setCheckable(true);
199 windows.arrangementMode.tabbed->setIcon(AM::autoTabbed::icon());
200 windows.arrangementMode.tabbed->setShortcut(
201 tr("Ctrl+Alt+T", "Windows|Arrangement mode|Tabbed"));
202 addAction(QStringLiteral("autoTabbed"), windows.arrangementMode.tabbed);
203
204 windows.arrangementMode.autoTileVertically = new QAction(this);
205 windows.arrangementMode.autoTileVertically->setCheckable(true);
206 windows.arrangementMode.autoTileVertically->setIcon(
207 AM::autoTileVertical::icon());
208 windows.arrangementMode.autoTileVertically->setShortcut(
209 tr("Ctrl+Alt+G",
210 "Windows|Arrangement mode|Auto tile vertically"));
211 addAction(QStringLiteral("autoVertical"),
212 windows.arrangementMode.autoTileVertically);
213
214 windows.arrangementMode.autoTileHorizontally = new QAction(this);
215 windows.arrangementMode.autoTileHorizontally->setCheckable(true);
216 windows.arrangementMode.autoTileHorizontally->setIcon(
217 AM::autoTileHorizontal::icon());
218 windows.arrangementMode.autoTileHorizontally->setShortcut(
219 tr("Ctrl+Alt+H",
220 "Windows|Arrangement mode|Auto tile horizontally"));
221 addAction(QStringLiteral("autoHorizontal"),
222 windows.arrangementMode.autoTileHorizontally);
223
224 windows.arrangementMode.autoTile = new QAction(this);
225 windows.arrangementMode.autoTile->setCheckable(true);
226 windows.arrangementMode.autoTile->setIcon(AM::autoTile::icon());
227 windows.arrangementMode.autoTile->setShortcut(
228 tr("Ctrl+Alt+I", "Windows|Arrangement mode|Auto tile"));
229 addAction(QStringLiteral("autoTile"), windows.arrangementMode.autoTile);
230
231 windows.arrangementMode.autoCascade = new QAction(this);
232 windows.arrangementMode.autoCascade->setCheckable(true);
233 windows.arrangementMode.autoCascade->setIcon(AM::autoCascade::icon());
234 windows.arrangementMode.autoCascade->setShortcut(
235 tr("Ctrl+Alt+J", "Windows|Arrangement mode|Auto cascade"));
236 addAction(QStringLiteral("autoCascade"),
237 windows.arrangementMode.autoCascade);
238
239 windows.saveAsNewSession = new QAction(this);
240 windows.saveAsNewSession->setIcon(
241 CResMgr::mainMenu::window::saveToNewProfile::icon());
242 windows.saveAsNewSession->setShortcut(
243 tr("Ctrl+Alt+S", "Windows|Save as new session..."));
244 addAction(QStringLiteral("saveNewSession"), windows.saveAsNewSession);
245
246 settings.bookshelfManager = new QAction(this);
247 settings.bookshelfManager->setIcon(
248 CResMgr::mainMenu::settings::swordSetupDialog::icon());
249 settings.bookshelfManager->setShortcut(
250 tr("F4", "Settings|Bookshelf Manager..."));
251 addAction(QStringLiteral("bookshelfWizard"), settings.bookshelfManager);
252
253 settings.configureBibleTime = new QAction(this);
254 settings.configureBibleTime->setMenuRole(QAction::PreferencesRole);
255 settings.configureBibleTime->setIcon(
256 CResMgr::mainMenu::settings::configureDialog::icon());
257 addAction(QStringLiteral("setPreferences"), settings.configureBibleTime);
258
259 help.handbook = new QAction(this);
260 help.handbook->setMenuRole(QAction::ApplicationSpecificRole);
261 help.handbook->setIcon(CResMgr::mainMenu::help::handbook::icon());
262 help.handbook->setShortcut(tr("F1", "Help|Handbook"));
263 addAction(QStringLiteral("openHandbook"), help.handbook);
264
265 help.bibleStudyHowto = new QAction(this);
266 help.bibleStudyHowto->setIcon(
267 CResMgr::mainMenu::help::bibleStudyHowTo::icon());
268 help.bibleStudyHowto->setShortcut(tr("F2", "Help|Bible Study Howto"));
269 addAction(QStringLiteral("bibleStudyHowto"), help.bibleStudyHowto);
270
271 help.tipOfTheDay = new QAction(this);
272 help.tipOfTheDay->setIcon(CResMgr::mainMenu::help::tipOfTheDay::icon());
273 help.tipOfTheDay->setShortcut(tr("F3", "Help|Tip of the day..."));
274 addAction(QStringLiteral("tipOfTheDay"), help.tipOfTheDay);
275
276 help.aboutBibleTime = new QAction(this);
277 help.aboutBibleTime->setMenuRole(QAction::AboutRole);
278 help.aboutBibleTime->setIcon(
279 CResMgr::mainMenu::help::aboutBibleTime::icon());
280 addAction(QStringLiteral("aboutBibleTime"), help.aboutBibleTime);
281
283}
284
286 file.quit->setText(tr("&Quit"));
287 file.quit->setToolTip(tr("Quit BibleTime"));
288
289 view.fullscreen->setText(tr("&Full screen"));
290 view.fullscreen->setToolTip(tr("Display BibleTime in full screen"));
291
292 view.showBookshelf->setText(tr("Show bookshelf"));
293 view.showBookshelf->setToolTip(
294 tr("Toggle visibility of the bookshelf window"));
295
296 view.showBookmarks->setText(tr("Show bookmarks"));
297 view.showBookmarks->setToolTip(
298 tr("Toggle visibility of the bookmarks window"));
299
300 view.showMag->setText(tr("Show mag"));
301 view.showMag->setToolTip(tr("Toggle visibility of the mag window"));
302
303 view.showParallelTextHeadings->setText(tr("Show parallel text headers"));
304 view.showParallelTextHeadings->setToolTip(
305 tr("Toggle the works header row visibility in windows"));
306
307 view.toolbars.showMainToolbar->setText(tr("Show main toolbar"));
308 view.toolbars.showMainToolbar->setToolTip(
309 tr("Toggle the main toolbar visibility"));
310
311 view.toolbars.showNavigationToolbar->setText(tr("Show navigation toolbar"));
312 view.toolbars.showNavigationToolbar->setToolTip(
313 tr("Toggle the navigation toolbar visibility"));
314
315 view.toolbars.showWorksToolbar->setText(tr("Show works toolbar"));
316 view.toolbars.showWorksToolbar->setToolTip(
317 tr("Toggle the works toolbar visibility"));
318
319 view.toolbars.showToolsToolbar->setText(tr("Show tools toolbar"));
320 view.toolbars.showToolsToolbar->setToolTip(
321 tr("Toggle the window tools toolbar visibility"));
322
323 view.toolbars.showToolbarsInTextWindows->setText(
324 tr("Show toolbars in text windows"));
325 view.toolbars.showToolbarsInTextWindows->setToolTip(
326 tr("Toggle the location of subwindow-specific toolbars between "
327 "the main window and subwindows"));
328
329 view.scroll.autoScrollUp->setText(tr("Auto scroll up"));
330 view.scroll.autoScrollUp->setToolTip(
331 tr("Adjust automatic scrolling speed in the up direction"));
332
333 view.scroll.autoScrollDown->setText(tr("Auto scroll down"));
334 view.scroll.autoScrollDown->setToolTip(
335 tr("Adjust automatic scrolling speed in the down direction"));
336
337 view.scroll.pauseAutoScroll->setText(tr("Pause auto scroll"));
338 view.scroll.pauseAutoScroll->setToolTip(tr("Pause/resume auto scrolling"));
339
340 search.searchOpenWorks->setText(tr("Search in &open works..."));
341 search.searchOpenWorks->setToolTip(
342 tr("Search in all works that are currently open"));
343
344 search.searchStandardBible->setText(tr("Search in standard &Bible..."));
345 search.searchStandardBible->setToolTip(tr("Search in the standard Bible"));
346
347 windows.closeWindow->setText(tr("Close &window"));
348 windows.closeWindow->setToolTip(tr("Close the current open window"));
349
350 windows.closeAllWindows->setText(tr("Cl&ose all windows"));
351 windows.closeAllWindows->setToolTip(
352 tr("Close all open windows inside BibleTime"));
353
354 windows.tileVertically->setText(tr("Tile &vertically"));
355 windows.tileVertically->setToolTip(
356 tr("Vertically tile (arrange side by side) the open windows"));
357
358 windows.tileHorizontally->setText(tr("Tile &horizontally"));
359 windows.tileHorizontally->setToolTip(
360 tr("Horizontally tile (arrange on top of each other) the open "
361 "windows"));
362
363 windows.tile->setText(tr("&Tile"));
364 windows.tile->setToolTip(tr("Tile the open windows"));
365
366 windows.cascade->setText(tr("&Cascade"));
367 windows.cascade->setToolTip(tr("Cascade the open windows"));
368
369 windows.arrangementMode.manual->setText(tr("&Manual mode"));
370 windows.arrangementMode.manual->setToolTip(
371 tr("Manually arrange the open windows"));
372
373 windows.arrangementMode.tabbed->setText(tr("Ta&bbed"));
374 windows.arrangementMode.tabbed->setToolTip(
375 tr("Automatically tab the open windows"));
376
377 windows.arrangementMode.autoTileVertically->setText(
378 tr("Auto-tile &vertically"));
379 windows.arrangementMode.autoTileVertically->setToolTip(
380 tr("Automatically tile the open windows vertically (arrange "
381 "side by side)"));
382
383 windows.arrangementMode.autoTileHorizontally->setText(
384 tr("Auto-tile &horizontally"));
385 windows.arrangementMode.autoTileHorizontally->setToolTip(
386 tr("Automatically tile the open windows horizontally (arrange "
387 "on top of each other)"));
388
389 windows.arrangementMode.autoTile->setText(tr("Auto-&tile"));
390 windows.arrangementMode.autoTile->setToolTip(
391 tr("Automatically tile the open windows"));
392
393 windows.arrangementMode.autoCascade->setText(tr("Auto-&cascade"));
394 windows.arrangementMode.autoCascade->setToolTip(
395 tr("Automatically cascade the open windows"));
396
397 windows.saveAsNewSession->setText(tr("Save as &new session..."));
398 windows.saveAsNewSession->setToolTip(tr("Create and save a new session"));
399
400 settings.bookshelfManager->setText(tr("Bookshelf Manager..."));
401 settings.bookshelfManager->setToolTip(
402 tr("Configure your bookshelf and install/update/remove/index "
403 "works"));
404
405 settings.configureBibleTime->setText(tr("&Configure BibleTime..."));
406 settings.configureBibleTime->setToolTip(tr("Set BibleTime's preferences"));
407
408 help.handbook->setText(tr("&Handbook"));
409 help.handbook->setToolTip(tr("Open BibleTime's handbook"));
410
411 help.bibleStudyHowto->setText(tr("&Bible Study Howto"));
412 help.bibleStudyHowto->setToolTip(
413 tr("Open the Bible study HowTo included with BibleTime.<br/>"
414 "This HowTo is an introduction on how to study the Bible in "
415 "an efficient way."));
416
417 help.tipOfTheDay->setText(tr("&Tip of the day..."));
418 help.tipOfTheDay->setToolTip(tr("Show tips about BibleTime"));
419
420 help.aboutBibleTime->setText(tr("&About BibleTime"));
421 help.aboutBibleTime->setToolTip(
422 tr("Information about the BibleTime program"));
423}
424
425/**Initializes the view of this widget*/
427
428 // Create menu and toolbar before the mdi area
430
432
434 addDockWidget(Qt::LeftDockWidgetArea, m_bookshelfDock);
435
436 m_bookmarksDock = new QDockWidget(this);
439 addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksDock);
440 tabifyDockWidget(m_bookmarksDock, m_bookshelfDock);
442
443 m_magDock = new QDockWidget(this);
444 m_infoDisplay = new CInfoDisplay(this);
445 m_infoDisplay->resize(150, 150);
446 m_magDock->setWidget(m_infoDisplay);
447 addDockWidget(Qt::LeftDockWidgetArea, m_magDock);
448
451 qOverload<CSwordModuleInfo *>(&CInfoDisplay::setInfo));
454 qOverload<Rendering::InfoType, QString const &>(
456
457 m_mdi->setMinimumSize(100, 100);
458 m_mdi->setFocusPolicy(Qt::ClickFocus);
459
460 BT_CONNECT(&m_autoScrollTimer, &QTimer::timeout,
462}
463
464static QToolBar* createToolBar(QWidget* parent, bool visible) {
465 QToolBar* bar = new QToolBar(parent);
466 bar->setFloatable(false);
467 bar->setMovable(true);
468 bar->setVisible(visible);
469 return bar;
470}
471
473 // Clear main window toolbars
474 m_navToolBar->clear();
475 m_worksToolBar->clear();
476 m_toolsToolBar->clear();
477}
478
481
482 return m_navToolBar->findChild<CKeyChooser *>();
483}
484
486{
487 // Create menubar
488 menuBar();
489
490 m_mainToolBar = createToolBar(this, true);
491 addToolBar(m_mainToolBar);
492
493 // Set visibility of main window toolbars based on config
494 bool visible =
495 !btConfig().session().value<bool>(
496 QStringLiteral("GUI/showToolbarsInEachWindow"),
497 true);
498
499 m_navToolBar = createToolBar(this, visible);
500 addToolBar(m_navToolBar);
501
503 m_worksToolBar->setVisible(visible);
504 addToolBar(m_worksToolBar);
505
506 m_toolsToolBar = createToolBar(this, visible);
507 addToolBar(m_toolsToolBar);
508}
509
511{
512 m_mdi = new CMDIArea(this);
513 m_findWidget = new BtFindWidget(this);
514 m_findWidget->setVisible(false);
515
516 QVBoxLayout* layout = new QVBoxLayout();
517 layout->setContentsMargins(0, 0, 0, 0);
518 layout->addWidget(m_mdi);
519 layout->addWidget(m_findWidget);
520
521 QWidget* widget = new QWidget(this);
522 widget->setLayout(layout);
523 setCentralWidget(widget);
524
527
530
533
534 BT_CONNECT(m_mdi, &CMDIArea::subWindowActivated,
536}
537
538/** Initializes the action objects of the GUI */
540 m_actions = new ActionCollection(m_bookshelfDock->toggleViewAction(),
541 m_bookmarksDock->toggleViewAction(),
542 m_magDock->toggleViewAction(),
543 this);
544
545 // File menu actions:
547 [this](CSwordModuleInfo * const module)
548 { createReadDisplayWindow(module); });
549 BT_CONNECT(m_actions->file.quit, &QAction::triggered,
550 this, &BibleTime::close);
551
552 // View menu actions:
553 BT_CONNECT(m_actions->view.fullscreen, &QAction::triggered,
555
556 auto const sessionGuiConf =
557 btConfig().session().group(QStringLiteral("GUI"));
558
560 sessionGuiConf.value<bool>(
561 QStringLiteral("showTextWindowHeaders"),
562 true));
565
567 sessionGuiConf.value<bool>(QStringLiteral("showMainToolbar"),
568 true));
569 BT_CONNECT(m_actions->view.toolbars.showMainToolbar, &QAction::triggered,
571
573 sessionGuiConf.value<bool>(
574 QStringLiteral("showTextWindowNavigator"), true));
576 &QAction::toggled,
578
580 sessionGuiConf.value<bool>(
581 QStringLiteral("showTextWindowModuleSelectorButtons"),
582 true));
585
587 sessionGuiConf.value<bool>(
588 QStringLiteral("showTextWindowToolButtons"),
589 true));
592
594 sessionGuiConf.value<bool>(
595 QStringLiteral("showToolbarsInEachWindow"),
596 true));
598 &QAction::toggled,
600
601 BT_CONNECT(m_actions->view.scroll.autoScrollUp, &QAction::triggered,
602 this, &BibleTime::autoScroll<true>);
603 BT_CONNECT(m_actions->view.scroll.autoScrollDown, &QAction::triggered,
604 this, &BibleTime::autoScroll<false>);
605 BT_CONNECT(m_actions->view.scroll.pauseAutoScroll, &QAction::triggered,
607
608 // Search menu actions:
609 BT_CONNECT(m_actions->search.searchOpenWorks, &QAction::triggered,
612 &QAction::triggered,
614
615 // Windows menu actions:
616 BT_CONNECT(m_actions->windows.closeWindow, &QAction::triggered,
617 m_mdi, &CMDIArea::closeActiveSubWindow);
618 BT_CONNECT(m_actions->windows.closeAllWindows, &QAction::triggered,
619 m_mdi, &CMDIArea::closeAllSubWindows);
620 BT_CONNECT(m_actions->windows.tileVertically, &QAction::triggered,
622 BT_CONNECT(m_actions->windows.tileHorizontally, &QAction::triggered,
624 BT_CONNECT(m_actions->windows.tile, &QAction::triggered,
625 this, &BibleTime::slotTile);
626 BT_CONNECT(m_actions->windows.cascade, &QAction::triggered,
628
629 alignmentMode alignment =
630 sessionGuiConf.value<alignmentMode>(QStringLiteral("alignmentMode"),
632
633 /*
634 * All actions related to arrangement modes have to be initialized before calling a slot on them,
635 * thus we call them afterwards now.
636 */
637 {
638
639 QAction * alignmentAction;
640 auto const & modeActions = m_actions->windows.arrangementMode;
641 switch (alignment) {
642 case autoTabbed:
643 alignmentAction = modeActions.tabbed; break;
644 case autoTileVertical:
645 alignmentAction = modeActions.autoTileVertically; break;
647 alignmentAction = modeActions.autoTileHorizontally; break;
648 case autoTile:
649 alignmentAction = modeActions.autoTile; break;
650 case autoCascade:
651 alignmentAction = modeActions.autoCascade; break;
652 case manual:
653 default:
654 alignmentAction = modeActions.manual; break;
655 }
656 alignmentAction->setChecked(true);
657 slotUpdateWindowArrangementActions(alignmentAction);
658 }
659 m_windowArrangementActionGroup = new QActionGroup(this);
672 BT_CONNECT(m_windowArrangementActionGroup, &QActionGroup::triggered,
674
675 BT_CONNECT(m_actions->windows.saveAsNewSession, &QAction::triggered,
677
678 // Settings menu actions:
679
680 BT_CONNECT(m_actions->settings.configureBibleTime, &QAction::triggered,
682 BT_CONNECT(m_actions->settings.bookshelfManager, &QAction::triggered,
684
685 // Help menu actions:
686
687 BT_CONNECT(m_actions->help.handbook, &QAction::triggered,
689 BT_CONNECT(m_actions->help.bibleStudyHowto, &QAction::triggered,
691 BT_CONNECT(m_actions->help.tipOfTheDay, &QAction::triggered,
693 BT_CONNECT(m_actions->help.aboutBibleTime, &QAction::triggered,
695
696 if (btApp->debugMode()) {
697 m_debugWidgetAction = new QAction(this);
698 m_debugWidgetAction->setCheckable(true);
699 BT_CONNECT(m_debugWidgetAction, &QAction::triggered,
701 }
702}
703
705 // File menu:
706 m_fileMenu = new QMenu(this);
707 m_fileMenu->addAction(m_actions->file.openWork);
708 m_fileMenu->addSeparator();
709 m_fileMenu->addAction(m_actions->file.quit);
710 menuBar()->addMenu(m_fileMenu);
711
712 // View menu:
713 m_viewMenu = new QMenu(this);
714 m_viewMenu->addAction(m_actions->view.fullscreen);
717 m_viewMenu->addAction(m_actions->view.showMag);
719 m_viewMenu->addSeparator();
720
721 m_toolBarsMenu = new QMenu(this);
726 m_toolBarsMenu->addSeparator();
727 m_toolBarsMenu->addAction(
729 m_viewMenu->addMenu(m_toolBarsMenu);
730 m_viewMenu->addSeparator();
731
732 m_scrollMenu= new QMenu(this);
736 m_viewMenu->addMenu(m_scrollMenu);
737
738 menuBar()->addMenu(m_viewMenu);
739
740 // Search menu:
741 m_searchMenu = new QMenu(this);
744 menuBar()->addMenu(m_searchMenu);
745
746 // Window menu:
747 m_windowsMenu = new QMenu(this);
748 m_openWindowsMenu = new QMenu(this);
749 BT_CONNECT(m_openWindowsMenu, &QMenu::aboutToShow,
754 m_windowsMenu->addSeparator();
757 m_windowsMenu->addAction(m_actions->windows.tile);
759 m_windowArrangementMenu = new QMenu(this);
760 m_windowArrangementMenu->addAction(
762 m_windowArrangementMenu->addAction(
764 m_windowArrangementMenu->addAction(
766 m_windowArrangementMenu->addAction(
768 m_windowArrangementMenu->addAction(
770 m_windowArrangementMenu->addAction(
772
774 m_windowsMenu->addSeparator();
776 m_windowLoadProfileMenu = new QMenu(this);
781 BT_CONNECT(m_windowLoadProfileMenu, &QMenu::triggered,
782 this, qOverload<QAction *>(&BibleTime::loadProfile));
783 BT_CONNECT(m_windowDeleteProfileMenu, &QMenu::triggered,
786 menuBar()->addMenu(m_windowsMenu);
787 BT_CONNECT(m_windowsMenu, &QMenu::aboutToShow,
789
790 m_settingsMenu = new QMenu(this);
792 m_settingsMenu->addSeparator();
794 menuBar()->addMenu(m_settingsMenu);
795
796 // Help menu:
797 m_helpMenu = new QMenu(this);
798 m_helpMenu->addAction(m_actions->help.handbook);
801 m_helpMenu->addSeparator();
804 m_helpMenu->addSeparator();
806 }
807 menuBar()->addMenu(m_helpMenu);
808}
809
811 QToolButton *openWorkButton = new QToolButton(this);
812 openWorkButton->setDefaultAction(m_actions->file.openWork);
813 openWorkButton->setPopupMode(QToolButton::InstantPopup);
814 m_mainToolBar->addWidget(openWorkButton);
815
819 m_mainToolBar->addAction(m_actions->view.showMag);
822}
823
825 m_bookmarksDock->setWindowTitle(tr("Bookmarks"));
826 m_magDock->setWindowTitle(tr("Mag"));
827 m_mainToolBar->setWindowTitle(tr("Main toolbar"));
828 m_navToolBar->setWindowTitle(tr("Navigation toolbar"));
829 m_worksToolBar->setWindowTitle(tr("Works toolbar"));
830 m_toolsToolBar->setWindowTitle(tr("Tools toolbar"));
831
832 m_fileMenu->setTitle(tr("&File"));
833 m_viewMenu->setTitle(tr("&View"));
834 m_toolBarsMenu->setTitle(tr("Toolbars"));
835 m_scrollMenu->setTitle(tr("Scroll"));
836
837 m_searchMenu->setTitle(tr("&Search"));
838 m_windowsMenu->setTitle(tr("&Windows"));
839 m_openWindowsMenu->setTitle(tr("O&pen windows"));
840 m_windowArrangementMenu->setTitle(tr("&Arrangement mode"));
841 m_windowLoadProfileMenu->setTitle(tr("Sw&itch session"));
842 m_windowDeleteProfileMenu->setTitle(tr("&Delete session"));
843
844 m_settingsMenu->setTitle(tr("Se&ttings"));
845
846 m_helpMenu->setTitle(tr("&Help"));
847
849 m_debugWidgetAction->setText(tr("Show \"What's this widget\" dialog"));
850
852}
853
854/** Initializes the SIGNAL / SLOT connections */
static QToolBar * createToolBar(QWidget *parent, bool visible)
#define btApp
#define BT_ASSERT(...)
Definition btassert.h:17
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
Definition btconfig.h:305
#define BT_CONNECT(...)
Definition btconnect.h:20
alignmentMode
Definition btglobal.h:70
@ autoTabbed
Definition btglobal.h:74
@ autoTileHorizontal
Definition btglobal.h:72
@ autoCascade
Definition btglobal.h:75
@ autoTile
Definition btglobal.h:73
@ autoTileVertical
Definition btglobal.h:71
@ manual
Definition btglobal.h:76
struct BibleTime::ActionCollection::@5 settings
struct BibleTime::ActionCollection::help help
struct BibleTime::ActionCollection::@3 search
struct BibleTime::ActionCollection::@1 file
BtOpenWorkAction * openWork
Definition bibletime.h:143
struct BibleTime::ActionCollection::@4 windows
struct BibleTime::ActionCollection::@2 view
struct BibleTime::ActionCollection::@2::@7 scroll
ActionCollection(QAction *showBookshelfAction, QAction *showBookmarksAction, QAction *showMagAction, QObject *parent=nullptr)
struct BibleTime::ActionCollection::@2::@6 toolbars
struct BibleTime::ActionCollection::@4::@8 arrangementMode
QAction * showToolbarsInTextWindows
Definition bibletime.h:158
void loadProfile(QAction *action)
QMenu * m_toolBarsMenu
Definition bibletime.h:455
void slotModuleUnlock(CSwordModuleInfo *module)
BtModuleChooserBar * m_worksToolBar
Definition bibletime.h:450
QMenu * m_searchMenu
Definition bibletime.h:457
void clearMdiToolBars()
QActionGroup * m_windowArrangementActionGroup
Definition bibletime.h:461
BtBookshelfDockWidget * m_bookshelfDock
Definition bibletime.h:442
void slotBookshelfWizard()
void slotOpenTipDialog()
void slotSearchModules()
void retranslateUi()
void slotShowDebugWindow(bool)
void moduleAbout(CSwordModuleInfo *module)
QDockWidget * m_magDock
Definition bibletime.h:445
CKeyChooser * keyChooser() const
QToolBar * m_mainToolBar
Definition bibletime.h:448
QAction * m_debugWidgetAction
Definition bibletime.h:477
QMenu * m_fileMenu
Definition bibletime.h:453
void slotActiveWindowChanged(QMdiSubWindow *window)
ActionCollection * m_actions
Definition bibletime.h:468
void deleteProfile(QAction *action)
void slotTileHorizontal()
CMDIArea * m_mdi
Definition bibletime.h:470
InfoDisplay::CInfoDisplay * m_infoDisplay
Definition bibletime.h:446
void slotUpdateWindowArrangementActions(QAction *trigerredAction)
void createCentralWidget()
void slotToggleWorksToolbar()
void slotOpenAboutDialog()
void initToolbars()
void openSearchDialog(BtConstModuleList modules, QString const &searchText={})
void slotSearchDefaultBible()
void slotSettingsOptions()
void slotToggleMainToolbar()
void autoScrollPause()
void slotToggleTextWindowHeader()
QDockWidget * m_bookmarksDock
Definition bibletime.h:443
CBookmarkIndex * m_bookmarksPage
Definition bibletime.h:444
void slotAutoScroll()
QMenu * m_settingsMenu
Definition bibletime.h:465
void slotOpenWindowsMenuAboutToShow()
void openOnlineHelp_Handbook()
void initConnections()
void createMenuAndToolBar()
QMenu * m_windowDeleteProfileMenu
Definition bibletime.h:464
void refreshProfileMenus()
void slotToggleToolsToolbar()
QToolBar * m_toolsToolBar
Definition bibletime.h:451
void slotToggleToolBarsInEachWindow()
QToolBar * m_navToolBar
Definition bibletime.h:449
BtFindWidget * m_findWidget
Definition bibletime.h:471
QMenu * m_viewMenu
Definition bibletime.h:454
void saveToNewProfile()
void slotTileVertical()
QMenu * m_scrollMenu
Definition bibletime.h:456
void openOnlineHelp_Howto()
void slotWindowMenuAboutToShow()
QMenu * m_windowsMenu
Definition bibletime.h:458
QMenu * m_helpMenu
Definition bibletime.h:466
QMenu * m_windowLoadProfileMenu
Definition bibletime.h:462
QActionGroup * m_windowLoadProfileActionGroup
Definition bibletime.h:463
CDisplayWindow * createReadDisplayWindow(QList< CSwordModuleInfo * > modules, QString const &key)
Creates a new presenter in the MDI area according to the type of the module.
void slotToggleNavigatorToolbar()
QTimer m_autoScrollTimer
Definition bibletime.h:474
QMenu * m_openWindowsMenu
Definition bibletime.h:459
void toggleFullscreen()
QMenu * m_windowArrangementMenu
Definition bibletime.h:460
void addAction(QString const &name, QAction *const action)
void moduleUnlockTriggered(CSwordModuleInfo *module)
void moduleHovered(CSwordModuleInfo *module)
void moduleOpenTriggered(CSwordModuleInfo *module)
void moduleAboutTriggered(CSwordModuleInfo *module)
void moduleSearchTriggered(CSwordModuleInfo *module)
BtConfigCore group(Prefix &&prefix) const &
T value(QString const &key, T const &defaultValue=T()) const
Returns the settings value for the given global key.
BtConfigCore session() const
Definition btconfig.cpp:213
void findPrevious()
void findNext()
void highlightText(QString const &text, bool caseSensitive)
void triggered(CSwordModuleInfo *module)
void createReadDisplayWindow(QList< CSwordModuleInfo * >, QString const &)
Emitted when a module should be opened.
void magInfoProvided(Rendering::InfoType const, QString const &data)
void highlightTextInActiveWindow(const QString &text, bool caseSensitive)
Definition cmdiarea.cpp:346
void findNextTextInActiveWindow()
Definition cmdiarea.cpp:342
void findPreviousTextInActiveWindow()
Definition cmdiarea.cpp:344
void setInfo(const QString &renderedData, const QString &lang=QString())