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-2026 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.searchActiveWindow = new QAction(this);
136 search.searchActiveWindow->setIcon(
137 CResMgr::mainMenu::mainIndex::search::icon());
138 search.searchActiveWindow->setShortcut(
139 tr("Ctrl+O", "Search|Search works in active window/tab"));
140 addAction(QStringLiteral("searchActiveWindow"),
141 search.searchActiveWindow);
142
143 search.searchOpenWorks = new QAction(this);
144 search.searchOpenWorks->setIcon(
145 CResMgr::mainMenu::mainIndex::search::icon());
146 search.searchOpenWorks->setShortcut(
147 tr("Ctrl+Shift+O", "Search|Search in all open works"));
148 addAction(QStringLiteral("searchOpenWorks"), search.searchOpenWorks);
149
150 search.searchStandardBible = new QAction(this);
151 search.searchStandardBible->setIcon(
152 CResMgr::mainMenu::mainIndex::searchdefaultbible::icon());
153 search.searchStandardBible->setShortcut(
154 tr("Ctrl+Alt+F", "Search|Search in the default Bible"));
155 addAction(QStringLiteral("searchStdBible"), search.searchStandardBible);
156
157 // Windows menu:
158
159 windows.closeWindow = new QAction(this);
160 windows.closeWindow->setIcon(CResMgr::mainMenu::window::close::icon());
161 windows.closeWindow->setShortcut(tr("Ctrl+W", "Windows|Close window"));
162 addAction(QStringLiteral("closeWindow"), windows.closeWindow);
163
164 windows.closeAllWindows = new QAction(this);
165 windows.closeAllWindows->setIcon(
166 CResMgr::mainMenu::window::closeAll::icon());
167 windows.closeAllWindows->setShortcut(
168 tr("Ctrl+Alt+W", "Windows|Close all windows"));
169 addAction(QStringLiteral("closeAllWindows"), windows.closeAllWindows);
170
171 windows.tileVertically = new QAction(this);
172 windows.tileVertically->setIcon(
173 CResMgr::mainMenu::window::tileVertical::icon());
174 windows.tileVertically->setShortcut(
175 tr("Ctrl+G", "Windows|Tile vertically"));
176 addAction(QStringLiteral("tileVertically"), windows.tileVertically);
177
178 windows.tileHorizontally = new QAction(this);
179 windows.tileHorizontally->setIcon(
180 CResMgr::mainMenu::window::tileHorizontal::icon());
181 windows.tileHorizontally->setShortcut(
182 tr("Ctrl+H", "Windows|Tile horizontally"));
183 addAction(QStringLiteral("tileHorizontally"), windows.tileHorizontally);
184
185 windows.tile = new QAction(this);
186 windows.tile->setIcon(CResMgr::mainMenu::window::tile::icon());
187 windows.tile->setShortcut(tr("Ctrl+I", "Windows|Tile"));
188 addAction(QStringLiteral("tile"), windows.tile);
189
190 windows.cascade = new QAction(this);
191 windows.cascade->setIcon(CResMgr::mainMenu::window::cascade::icon());
192 windows.cascade->setShortcut(tr("Ctrl+J", "Windows|Cascade"));
193 addAction(QStringLiteral("cascade"), windows.cascade);
194
196
197 windows.arrangementMode.manual = new QAction(this);
198 windows.arrangementMode.manual->setCheckable(true);
199 windows.arrangementMode.manual->setIcon(AM::manual::icon());
200 windows.arrangementMode.manual->setShortcut(
201 tr("Ctrl+Alt+M", "Windows|Arrangement mode|Manual"));
202 addAction(QStringLiteral("manualArrangement"),
203 windows.arrangementMode.manual);
204
205 windows.arrangementMode.tabbed = new QAction(this);
206 windows.arrangementMode.tabbed->setCheckable(true);
207 windows.arrangementMode.tabbed->setIcon(AM::autoTabbed::icon());
208 windows.arrangementMode.tabbed->setShortcut(
209 tr("Ctrl+Alt+T", "Windows|Arrangement mode|Tabbed"));
210 addAction(QStringLiteral("autoTabbed"), windows.arrangementMode.tabbed);
211
212 windows.arrangementMode.autoTileVertically = new QAction(this);
213 windows.arrangementMode.autoTileVertically->setCheckable(true);
214 windows.arrangementMode.autoTileVertically->setIcon(
215 AM::autoTileVertical::icon());
216 windows.arrangementMode.autoTileVertically->setShortcut(
217 tr("Ctrl+Alt+G",
218 "Windows|Arrangement mode|Auto tile vertically"));
219 addAction(QStringLiteral("autoVertical"),
220 windows.arrangementMode.autoTileVertically);
221
222 windows.arrangementMode.autoTileHorizontally = new QAction(this);
223 windows.arrangementMode.autoTileHorizontally->setCheckable(true);
224 windows.arrangementMode.autoTileHorizontally->setIcon(
225 AM::autoTileHorizontal::icon());
226 windows.arrangementMode.autoTileHorizontally->setShortcut(
227 tr("Ctrl+Alt+H",
228 "Windows|Arrangement mode|Auto tile horizontally"));
229 addAction(QStringLiteral("autoHorizontal"),
230 windows.arrangementMode.autoTileHorizontally);
231
232 windows.arrangementMode.autoTile = new QAction(this);
233 windows.arrangementMode.autoTile->setCheckable(true);
234 windows.arrangementMode.autoTile->setIcon(AM::autoTile::icon());
235 windows.arrangementMode.autoTile->setShortcut(
236 tr("Ctrl+Alt+I", "Windows|Arrangement mode|Auto tile"));
237 addAction(QStringLiteral("autoTile"), windows.arrangementMode.autoTile);
238
239 windows.arrangementMode.autoCascade = new QAction(this);
240 windows.arrangementMode.autoCascade->setCheckable(true);
241 windows.arrangementMode.autoCascade->setIcon(AM::autoCascade::icon());
242 windows.arrangementMode.autoCascade->setShortcut(
243 tr("Ctrl+Alt+J", "Windows|Arrangement mode|Auto cascade"));
244 addAction(QStringLiteral("autoCascade"),
245 windows.arrangementMode.autoCascade);
246
247 windows.saveAsNewSession = new QAction(this);
248 windows.saveAsNewSession->setIcon(
249 CResMgr::mainMenu::window::saveToNewProfile::icon());
250 windows.saveAsNewSession->setShortcut(
251 tr("Ctrl+Alt+S", "Windows|Save as new session..."));
252 addAction(QStringLiteral("saveNewSession"), windows.saveAsNewSession);
253
254 settings.bookshelfManager = new QAction(this);
255 settings.bookshelfManager->setIcon(
256 CResMgr::mainMenu::settings::swordSetupDialog::icon());
257 settings.bookshelfManager->setShortcut(
258 tr("F4", "Settings|Bookshelf Manager..."));
259 addAction(QStringLiteral("bookshelfWizard"), settings.bookshelfManager);
260
261 settings.configureBibleTime = new QAction(this);
262 settings.configureBibleTime->setMenuRole(QAction::PreferencesRole);
263 settings.configureBibleTime->setIcon(
264 CResMgr::mainMenu::settings::configureDialog::icon());
265 addAction(QStringLiteral("setPreferences"), settings.configureBibleTime);
266
267 help.handbook = new QAction(this);
268 help.handbook->setMenuRole(QAction::ApplicationSpecificRole);
269 help.handbook->setIcon(CResMgr::mainMenu::help::handbook::icon());
270 help.handbook->setShortcut(tr("F1", "Help|Handbook"));
271 addAction(QStringLiteral("openHandbook"), help.handbook);
272
273 help.bibleStudyHowto = new QAction(this);
274 help.bibleStudyHowto->setIcon(
275 CResMgr::mainMenu::help::bibleStudyHowTo::icon());
276 help.bibleStudyHowto->setShortcut(tr("F2", "Help|Bible Study Howto"));
277 addAction(QStringLiteral("bibleStudyHowto"), help.bibleStudyHowto);
278
279 help.tipOfTheDay = new QAction(this);
280 help.tipOfTheDay->setIcon(CResMgr::mainMenu::help::tipOfTheDay::icon());
281 help.tipOfTheDay->setShortcut(tr("F3", "Help|Tip of the day..."));
282 addAction(QStringLiteral("tipOfTheDay"), help.tipOfTheDay);
283
284 help.aboutBibleTime = new QAction(this);
285 help.aboutBibleTime->setMenuRole(QAction::AboutRole);
286 help.aboutBibleTime->setIcon(
287 CResMgr::mainMenu::help::aboutBibleTime::icon());
288 addAction(QStringLiteral("aboutBibleTime"), help.aboutBibleTime);
289
291}
292
294 file.quit->setText(tr("&Quit"));
295 file.quit->setToolTip(tr("Quit BibleTime"));
296
297 view.fullscreen->setText(tr("&Full screen"));
298 view.fullscreen->setToolTip(tr("Display BibleTime in full screen"));
299
300 view.showBookshelf->setText(tr("Show bookshelf"));
301 view.showBookshelf->setToolTip(
302 tr("Toggle visibility of the bookshelf window"));
303
304 view.showBookmarks->setText(tr("Show bookmarks"));
305 view.showBookmarks->setToolTip(
306 tr("Toggle visibility of the bookmarks window"));
307
308 view.showMag->setText(tr("Show mag"));
309 view.showMag->setToolTip(tr("Toggle visibility of the mag window"));
310
311 view.showParallelTextHeadings->setText(tr("Show parallel text headers"));
312 view.showParallelTextHeadings->setToolTip(
313 tr("Toggle the works header row visibility in windows"));
314
315 view.toolbars.showMainToolbar->setText(tr("Show main toolbar"));
316 view.toolbars.showMainToolbar->setToolTip(
317 tr("Toggle the main toolbar visibility"));
318
319 view.toolbars.showNavigationToolbar->setText(tr("Show navigation toolbar"));
320 view.toolbars.showNavigationToolbar->setToolTip(
321 tr("Toggle the navigation toolbar visibility"));
322
323 view.toolbars.showWorksToolbar->setText(tr("Show works toolbar"));
324 view.toolbars.showWorksToolbar->setToolTip(
325 tr("Toggle the works toolbar visibility"));
326
327 view.toolbars.showToolsToolbar->setText(tr("Show tools toolbar"));
328 view.toolbars.showToolsToolbar->setToolTip(
329 tr("Toggle the window tools toolbar visibility"));
330
331 view.toolbars.showToolbarsInTextWindows->setText(
332 tr("Show toolbars in text windows"));
333 view.toolbars.showToolbarsInTextWindows->setToolTip(
334 tr("Toggle the location of subwindow-specific toolbars between "
335 "the main window and subwindows"));
336
337 view.scroll.autoScrollUp->setText(tr("Auto scroll up"));
338 view.scroll.autoScrollUp->setToolTip(
339 tr("Adjust automatic scrolling speed in the up direction"));
340
341 view.scroll.autoScrollDown->setText(tr("Auto scroll down"));
342 view.scroll.autoScrollDown->setToolTip(
343 tr("Adjust automatic scrolling speed in the down direction"));
344
345 view.scroll.pauseAutoScroll->setText(tr("Pause auto scroll"));
346 view.scroll.pauseAutoScroll->setToolTip(tr("Pause/resume auto scrolling"));
347
348 search.searchActiveWindow->setText(
349 tr("&Search works in active window/tab..."));
350 search.searchActiveWindow->setToolTip(
351 tr("Search in all works in the active open window or tab"));
352
353 search.searchOpenWorks->setText(tr("Search in all &open works..."));
354 search.searchOpenWorks->setToolTip(
355 tr("Search in all works that are currently open"));
356
357 search.searchStandardBible->setText(tr("Search in standard &Bible..."));
358 search.searchStandardBible->setToolTip(tr("Search in the standard Bible"));
359
360 windows.closeWindow->setText(tr("Close &window"));
361 windows.closeWindow->setToolTip(tr("Close the current open window"));
362
363 windows.closeAllWindows->setText(tr("Cl&ose all windows"));
364 windows.closeAllWindows->setToolTip(
365 tr("Close all open windows inside BibleTime"));
366
367 windows.tileVertically->setText(tr("Tile &vertically"));
368 windows.tileVertically->setToolTip(
369 tr("Vertically tile (arrange side by side) the open windows"));
370
371 windows.tileHorizontally->setText(tr("Tile &horizontally"));
372 windows.tileHorizontally->setToolTip(
373 tr("Horizontally tile (arrange on top of each other) the open "
374 "windows"));
375
376 windows.tile->setText(tr("&Tile"));
377 windows.tile->setToolTip(tr("Tile the open windows"));
378
379 windows.cascade->setText(tr("&Cascade"));
380 windows.cascade->setToolTip(tr("Cascade the open windows"));
381
382 windows.arrangementMode.manual->setText(tr("&Manual mode"));
383 windows.arrangementMode.manual->setToolTip(
384 tr("Manually arrange the open windows"));
385
386 windows.arrangementMode.tabbed->setText(tr("Ta&bbed"));
387 windows.arrangementMode.tabbed->setToolTip(
388 tr("Automatically tab the open windows"));
389
390 windows.arrangementMode.autoTileVertically->setText(
391 tr("Auto-tile &vertically"));
392 windows.arrangementMode.autoTileVertically->setToolTip(
393 tr("Automatically tile the open windows vertically (arrange "
394 "side by side)"));
395
396 windows.arrangementMode.autoTileHorizontally->setText(
397 tr("Auto-tile &horizontally"));
398 windows.arrangementMode.autoTileHorizontally->setToolTip(
399 tr("Automatically tile the open windows horizontally (arrange "
400 "on top of each other)"));
401
402 windows.arrangementMode.autoTile->setText(tr("Auto-&tile"));
403 windows.arrangementMode.autoTile->setToolTip(
404 tr("Automatically tile the open windows"));
405
406 windows.arrangementMode.autoCascade->setText(tr("Auto-&cascade"));
407 windows.arrangementMode.autoCascade->setToolTip(
408 tr("Automatically cascade the open windows"));
409
410 windows.saveAsNewSession->setText(tr("Save as &new session..."));
411 windows.saveAsNewSession->setToolTip(tr("Create and save a new session"));
412
413 settings.bookshelfManager->setText(tr("Bookshelf Manager..."));
414 settings.bookshelfManager->setToolTip(
415 tr("Configure your bookshelf and install/update/remove/index "
416 "works"));
417
418 settings.configureBibleTime->setText(tr("&Configure BibleTime..."));
419 settings.configureBibleTime->setToolTip(tr("Set BibleTime's preferences"));
420
421 help.handbook->setText(tr("&Handbook"));
422 help.handbook->setToolTip(tr("Open BibleTime's handbook"));
423
424 help.bibleStudyHowto->setText(tr("&Bible Study Howto"));
425 help.bibleStudyHowto->setToolTip(
426 tr("Open the Bible study HowTo included with BibleTime.<br/>"
427 "This HowTo is an introduction on how to study the Bible in "
428 "an efficient way."));
429
430 help.tipOfTheDay->setText(tr("&Tip of the day..."));
431 help.tipOfTheDay->setToolTip(tr("Show tips about BibleTime"));
432
433 help.aboutBibleTime->setText(tr("&About BibleTime"));
434 help.aboutBibleTime->setToolTip(
435 tr("Information about the BibleTime program"));
436}
437
438/**Initializes the view of this widget*/
440
441 // Create menu and toolbar before the mdi area
443
445
447 m_bookshelfDock->setObjectName("bookshelfDock");
448 addDockWidget(Qt::LeftDockWidgetArea, m_bookshelfDock);
449
450 m_bookmarksDock = new QDockWidget(this);
451 m_bookmarksDock->setObjectName("bookmarksDock");
454 addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksDock);
455 tabifyDockWidget(m_bookmarksDock, m_bookshelfDock);
457
458 m_magDock = new QDockWidget(this);
459 m_magDock->setObjectName("magDock");
460 m_infoDisplay = new CInfoDisplay(this);
461 m_infoDisplay->resize(150, 150);
462 m_magDock->setWidget(m_infoDisplay);
463 addDockWidget(Qt::LeftDockWidgetArea, m_magDock);
464
467 qOverload<CSwordModuleInfo *>(&CInfoDisplay::setInfo));
470 qOverload<Rendering::InfoType, QString const &>(
472
473 m_mdi->setMinimumSize(100, 100);
474 m_mdi->setFocusPolicy(Qt::ClickFocus);
475
476 BT_CONNECT(&m_autoScrollTimer, &QTimer::timeout,
478}
479
480static QToolBar* createToolBar(QWidget* parent, bool visible) {
481 QToolBar* bar = new QToolBar(parent);
482 bar->setFloatable(false);
483 bar->setMovable(true);
484 bar->setVisible(visible);
485 return bar;
486}
487
489 // Clear main window toolbars
490 m_navToolBar->clear();
491 m_worksToolBar->clear();
492 m_toolsToolBar->clear();
493}
494
497
498 return m_navToolBar->findChild<CKeyChooser *>();
499}
500
502{
503 // Create menubar
504 menuBar();
505
506 m_mainToolBar = createToolBar(this, true);
507 m_mainToolBar->setObjectName("mainToolBar");
508 addToolBar(m_mainToolBar);
509
510 // Set visibility of main window toolbars based on config
511 bool visible =
512 !btConfig().session().value<bool>(
513 QStringLiteral("GUI/showToolbarsInEachWindow"),
514 true);
515
516 m_navToolBar = createToolBar(this, visible);
517 m_navToolBar->setObjectName("navToolBar");
518 addToolBar(m_navToolBar);
519
521 m_worksToolBar->setObjectName("worksToolBar");
522 m_worksToolBar->setVisible(visible);
523 addToolBar(m_worksToolBar);
524
525 m_toolsToolBar = createToolBar(this, visible);
526 m_toolsToolBar->setObjectName("toolsToolBar");
527 addToolBar(m_toolsToolBar);
528}
529
531{
532 m_mdi = new CMDIArea(this);
533 m_findWidget = new BtFindWidget(this);
534 m_findWidget->setVisible(false);
535
536 QVBoxLayout* layout = new QVBoxLayout();
537 layout->setContentsMargins(0, 0, 0, 0);
538 layout->addWidget(m_mdi);
539 layout->addWidget(m_findWidget);
540
541 QWidget* widget = new QWidget(this);
542 widget->setLayout(layout);
543 setCentralWidget(widget);
544
547
550
553
554 BT_CONNECT(m_mdi, &CMDIArea::subWindowActivated,
556}
557
558/** Initializes the action objects of the GUI */
560 m_actions = new ActionCollection(m_bookshelfDock->toggleViewAction(),
561 m_bookmarksDock->toggleViewAction(),
562 m_magDock->toggleViewAction(),
563 this);
564
565 // File menu actions:
567 [this](CSwordModuleInfo * const module)
568 { createReadDisplayWindow(module); });
569 BT_CONNECT(m_actions->file.quit, &QAction::triggered,
570 this, &BibleTime::close);
571
572 // View menu actions:
573 BT_CONNECT(m_actions->view.fullscreen, &QAction::triggered,
575
576 auto const sessionGuiConf =
577 btConfig().session().group(QStringLiteral("GUI"));
578
580 sessionGuiConf.value<bool>(
581 QStringLiteral("showTextWindowHeaders"),
582 true));
585
587 sessionGuiConf.value<bool>(QStringLiteral("showMainToolbar"),
588 true));
589 BT_CONNECT(m_actions->view.toolbars.showMainToolbar, &QAction::triggered,
591
593 sessionGuiConf.value<bool>(
594 QStringLiteral("showTextWindowNavigator"), true));
596 &QAction::toggled,
598
600 sessionGuiConf.value<bool>(
601 QStringLiteral("showTextWindowModuleSelectorButtons"),
602 true));
605
607 sessionGuiConf.value<bool>(
608 QStringLiteral("showTextWindowToolButtons"),
609 true));
612
614 sessionGuiConf.value<bool>(
615 QStringLiteral("showToolbarsInEachWindow"),
616 true));
618 &QAction::toggled,
620
621 BT_CONNECT(m_actions->view.scroll.autoScrollUp, &QAction::triggered,
622 this, &BibleTime::autoScroll<true>);
623 BT_CONNECT(m_actions->view.scroll.autoScrollDown, &QAction::triggered,
624 this, &BibleTime::autoScroll<false>);
625 BT_CONNECT(m_actions->view.scroll.pauseAutoScroll, &QAction::triggered,
627
628 // Search menu actions:
629 BT_CONNECT(m_actions->search.searchActiveWindow, &QAction::triggered,
631 BT_CONNECT(m_actions->search.searchOpenWorks, &QAction::triggered,
634 &QAction::triggered,
636
637 // Windows menu actions:
638 BT_CONNECT(m_actions->windows.closeWindow, &QAction::triggered,
639 m_mdi, &CMDIArea::closeActiveSubWindow);
640 BT_CONNECT(m_actions->windows.closeAllWindows, &QAction::triggered,
641 m_mdi, &CMDIArea::closeAllSubWindows);
642 BT_CONNECT(m_actions->windows.tileVertically, &QAction::triggered,
644 BT_CONNECT(m_actions->windows.tileHorizontally, &QAction::triggered,
646 BT_CONNECT(m_actions->windows.tile, &QAction::triggered,
647 this, &BibleTime::slotTile);
648 BT_CONNECT(m_actions->windows.cascade, &QAction::triggered,
650
651 alignmentMode alignment =
652 sessionGuiConf.value<alignmentMode>(QStringLiteral("alignmentMode"),
654
655 /*
656 * All actions related to arrangement modes have to be initialized before calling a slot on them,
657 * thus we call them afterwards now.
658 */
659 {
660
661 QAction * alignmentAction;
662 auto const & modeActions = m_actions->windows.arrangementMode;
663 switch (alignment) {
664 case autoTabbed:
665 alignmentAction = modeActions.tabbed; break;
666 case autoTileVertical:
667 alignmentAction = modeActions.autoTileVertically; break;
669 alignmentAction = modeActions.autoTileHorizontally; break;
670 case autoTile:
671 alignmentAction = modeActions.autoTile; break;
672 case autoCascade:
673 alignmentAction = modeActions.autoCascade; break;
674 case manual:
675 default:
676 alignmentAction = modeActions.manual; break;
677 }
678 alignmentAction->setChecked(true);
679 slotUpdateWindowArrangementActions(alignmentAction);
680 }
681 m_windowArrangementActionGroup = new QActionGroup(this);
694 BT_CONNECT(m_windowArrangementActionGroup, &QActionGroup::triggered,
696
697 BT_CONNECT(m_actions->windows.saveAsNewSession, &QAction::triggered,
699
700 // Settings menu actions:
701
702 BT_CONNECT(m_actions->settings.configureBibleTime, &QAction::triggered,
704 BT_CONNECT(m_actions->settings.bookshelfManager, &QAction::triggered,
706
707 // Help menu actions:
708
709 BT_CONNECT(m_actions->help.handbook, &QAction::triggered,
711 BT_CONNECT(m_actions->help.bibleStudyHowto, &QAction::triggered,
713 BT_CONNECT(m_actions->help.tipOfTheDay, &QAction::triggered,
715 BT_CONNECT(m_actions->help.aboutBibleTime, &QAction::triggered,
717
718 if (btApp->debugMode()) {
719 m_debugWidgetAction = new QAction(this);
720 m_debugWidgetAction->setCheckable(true);
721 BT_CONNECT(m_debugWidgetAction, &QAction::triggered,
723 }
724}
725
727 // File menu:
728 m_fileMenu = new QMenu(this);
729 m_fileMenu->addAction(m_actions->file.openWork);
730 m_fileMenu->addSeparator();
731 m_fileMenu->addAction(m_actions->file.quit);
732 menuBar()->addMenu(m_fileMenu);
733
734 // View menu:
735 m_viewMenu = new QMenu(this);
736 m_viewMenu->addAction(m_actions->view.fullscreen);
739 m_viewMenu->addAction(m_actions->view.showMag);
741 m_viewMenu->addSeparator();
742
743 m_toolBarsMenu = new QMenu(this);
748 m_toolBarsMenu->addSeparator();
749 m_toolBarsMenu->addAction(
751 m_viewMenu->addMenu(m_toolBarsMenu);
752 m_viewMenu->addSeparator();
753
754 m_scrollMenu= new QMenu(this);
758 m_viewMenu->addMenu(m_scrollMenu);
759
760 menuBar()->addMenu(m_viewMenu);
761
762 // Search menu:
763 m_searchMenu = new QMenu(this);
767 menuBar()->addMenu(m_searchMenu);
768
769 // Window menu:
770 m_windowsMenu = new QMenu(this);
771 m_openWindowsMenu = new QMenu(this);
772 BT_CONNECT(m_openWindowsMenu, &QMenu::aboutToShow,
777 m_windowsMenu->addSeparator();
780 m_windowsMenu->addAction(m_actions->windows.tile);
782 m_windowArrangementMenu = new QMenu(this);
783 m_windowArrangementMenu->addAction(
785 m_windowArrangementMenu->addAction(
787 m_windowArrangementMenu->addAction(
789 m_windowArrangementMenu->addAction(
791 m_windowArrangementMenu->addAction(
793 m_windowArrangementMenu->addAction(
795
797 m_windowsMenu->addSeparator();
799 m_windowLoadProfileMenu = new QMenu(this);
804 BT_CONNECT(m_windowLoadProfileMenu, &QMenu::triggered,
805 this, qOverload<QAction *>(&BibleTime::loadProfile));
806 BT_CONNECT(m_windowDeleteProfileMenu, &QMenu::triggered,
809 menuBar()->addMenu(m_windowsMenu);
810 BT_CONNECT(m_windowsMenu, &QMenu::aboutToShow,
812
813 m_settingsMenu = new QMenu(this);
815 m_settingsMenu->addSeparator();
817 menuBar()->addMenu(m_settingsMenu);
818
819 // Help menu:
820 m_helpMenu = new QMenu(this);
821 m_helpMenu->addAction(m_actions->help.handbook);
824 m_helpMenu->addSeparator();
827 m_helpMenu->addSeparator();
829 }
830 menuBar()->addMenu(m_helpMenu);
831}
832
834 QToolButton *openWorkButton = new QToolButton(this);
835 openWorkButton->setDefaultAction(m_actions->file.openWork);
836 openWorkButton->setPopupMode(QToolButton::InstantPopup);
837 m_mainToolBar->addWidget(openWorkButton);
838
842 m_mainToolBar->addAction(m_actions->view.showMag);
845}
846
848 m_bookmarksDock->setWindowTitle(tr("Bookmarks"));
849 m_magDock->setWindowTitle(tr("Mag"));
850 m_mainToolBar->setWindowTitle(tr("Main toolbar"));
851 m_navToolBar->setWindowTitle(tr("Navigation toolbar"));
852 m_worksToolBar->setWindowTitle(tr("Works toolbar"));
853 m_toolsToolBar->setWindowTitle(tr("Tools toolbar"));
854
855 m_fileMenu->setTitle(tr("&File"));
856 m_viewMenu->setTitle(tr("&View"));
857 m_toolBarsMenu->setTitle(tr("Toolbars"));
858 m_scrollMenu->setTitle(tr("Scroll"));
859
860 m_searchMenu->setTitle(tr("&Search"));
861 m_windowsMenu->setTitle(tr("&Windows"));
862 m_openWindowsMenu->setTitle(tr("O&pen windows"));
863 m_windowArrangementMenu->setTitle(tr("&Arrangement mode"));
864 m_windowLoadProfileMenu->setTitle(tr("Sw&itch session"));
865 m_windowDeleteProfileMenu->setTitle(tr("&Delete session"));
866
867 m_settingsMenu->setTitle(tr("Se&ttings"));
868
869 m_helpMenu->setTitle(tr("&Help"));
870
872 m_debugWidgetAction->setText(tr("Show \"What's this widget\" dialog"));
873
875}
876
877/** 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:146
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:161
void loadProfile(QAction *action)
QMenu * m_toolBarsMenu
Definition bibletime.h:476
void slotModuleUnlock(CSwordModuleInfo *module)
BtModuleChooserBar * m_worksToolBar
Definition bibletime.h:471
QMenu * m_searchMenu
Definition bibletime.h:478
void clearMdiToolBars()
QActionGroup * m_windowArrangementActionGroup
Definition bibletime.h:482
BtBookshelfDockWidget * m_bookshelfDock
Definition bibletime.h:463
void slotBookshelfWizard()
void slotOpenTipDialog()
void slotSearchModules()
void retranslateUi()
void slotShowDebugWindow(bool)
void moduleAbout(CSwordModuleInfo *module)
QDockWidget * m_magDock
Definition bibletime.h:466
CKeyChooser * keyChooser() const
QToolBar * m_mainToolBar
Definition bibletime.h:469
QAction * m_debugWidgetAction
Definition bibletime.h:498
QMenu * m_fileMenu
Definition bibletime.h:474
void slotActiveWindowChanged(QMdiSubWindow *window)
ActionCollection * m_actions
Definition bibletime.h:489
void slotSearchActiveWindow()
void deleteProfile(QAction *action)
void slotTileHorizontal()
CMDIArea * m_mdi
Definition bibletime.h:491
InfoDisplay::CInfoDisplay * m_infoDisplay
Definition bibletime.h:467
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:464
CBookmarkIndex * m_bookmarksPage
Definition bibletime.h:465
void slotAutoScroll()
QMenu * m_settingsMenu
Definition bibletime.h:486
void slotOpenWindowsMenuAboutToShow()
void openOnlineHelp_Handbook()
void initConnections()
void createMenuAndToolBar()
QMenu * m_windowDeleteProfileMenu
Definition bibletime.h:485
void refreshProfileMenus()
void slotToggleToolsToolbar()
QToolBar * m_toolsToolBar
Definition bibletime.h:472
void slotToggleToolBarsInEachWindow()
QToolBar * m_navToolBar
Definition bibletime.h:470
BtFindWidget * m_findWidget
Definition bibletime.h:492
QMenu * m_viewMenu
Definition bibletime.h:475
void saveToNewProfile()
void slotTileVertical()
QMenu * m_scrollMenu
Definition bibletime.h:477
void openOnlineHelp_Howto()
void slotWindowMenuAboutToShow()
QMenu * m_windowsMenu
Definition bibletime.h:479
QMenu * m_helpMenu
Definition bibletime.h:487
QMenu * m_windowLoadProfileMenu
Definition bibletime.h:483
QActionGroup * m_windowLoadProfileActionGroup
Definition bibletime.h:484
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:495
QMenu * m_openWindowsMenu
Definition bibletime.h:480
void toggleFullscreen()
QMenu * m_windowArrangementMenu
Definition bibletime.h:481
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:212
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())