mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Drop redundant Kiwixapp::mp_tabWidget pointer
No need to story what can be easily get.
This commit is contained in:
parent
6ac401c1f0
commit
5e7b856f72
@ -81,9 +81,8 @@ void KiwixApp::init()
|
|||||||
|
|
||||||
createAction();
|
createAction();
|
||||||
mp_mainWindow = new MainWindow;
|
mp_mainWindow = new MainWindow;
|
||||||
mp_tabWidget = mp_mainWindow->getTabBar();
|
getTabWidget()->setContentManagerView(mp_manager->getView());
|
||||||
mp_tabWidget->setContentManagerView(mp_manager->getView());
|
getTabWidget()->setNewTabButton();
|
||||||
mp_tabWidget->setNewTabButton();
|
|
||||||
postInit();
|
postInit();
|
||||||
mp_errorDialog = new QErrorMessage(mp_mainWindow);
|
mp_errorDialog = new QErrorMessage(mp_mainWindow);
|
||||||
setActivationWindow(mp_mainWindow);
|
setActivationWindow(mp_mainWindow);
|
||||||
@ -186,14 +185,14 @@ void KiwixApp::openZimFile(const QString &zimfile)
|
|||||||
|
|
||||||
void KiwixApp::printPage()
|
void KiwixApp::printPage()
|
||||||
{
|
{
|
||||||
if(!mp_tabWidget->currentZimView())
|
if(!getTabWidget()->currentZimView())
|
||||||
return;
|
return;
|
||||||
QPrinter* printer = new QPrinter();
|
QPrinter* printer = new QPrinter();
|
||||||
QPrintDialog printDialog(printer, mp_mainWindow);
|
QPrintDialog printDialog(printer, mp_mainWindow);
|
||||||
printDialog.setStyle(nullptr);
|
printDialog.setStyle(nullptr);
|
||||||
printDialog.setStyleSheet("");
|
printDialog.setStyleSheet("");
|
||||||
if (printDialog.exec() == QDialog::Accepted) {
|
if (printDialog.exec() == QDialog::Accepted) {
|
||||||
auto webview = mp_tabWidget->currentWebView();
|
auto webview = getTabWidget()->currentWebView();
|
||||||
if(!webview)
|
if(!webview)
|
||||||
return;
|
return;
|
||||||
webview->page()->print(printer, [=](bool success) {
|
webview->page()->print(printer, [=](bool success) {
|
||||||
@ -210,12 +209,12 @@ void KiwixApp::openUrl(const QString &url, bool newTab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void KiwixApp::openUrl(const QUrl &url, bool newTab) {
|
void KiwixApp::openUrl(const QUrl &url, bool newTab) {
|
||||||
mp_tabWidget->openUrl(url, newTab);
|
getTabWidget()->openUrl(url, newTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KiwixApp::openRandomUrl(bool newTab)
|
void KiwixApp::openRandomUrl(bool newTab)
|
||||||
{
|
{
|
||||||
auto zimId = mp_tabWidget->currentZimId();
|
auto zimId = getTabWidget()->currentZimId();
|
||||||
if (zimId.isEmpty()) {
|
if (zimId.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -354,7 +353,7 @@ void KiwixApp::createAction()
|
|||||||
CREATE_ACTION(FindInPageAction, gt("find-in-page"));
|
CREATE_ACTION(FindInPageAction, gt("find-in-page"));
|
||||||
mpa_actions[FindInPageAction]->setShortcuts({QKeySequence::Find, Qt::Key_F3});
|
mpa_actions[FindInPageAction]->setShortcuts({QKeySequence::Find, Qt::Key_F3});
|
||||||
connect(mpa_actions[FindInPageAction], &QAction::triggered,
|
connect(mpa_actions[FindInPageAction], &QAction::triggered,
|
||||||
this, [=]() { mp_tabWidget->openFindInPageBar(); });
|
this, [=]() { getTabWidget()->openFindInPageBar(); });
|
||||||
|
|
||||||
CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), QKeySequence::FullScreen);
|
CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), QKeySequence::FullScreen);
|
||||||
connect(mpa_actions[ToggleFullscreenAction], &QAction::toggled,
|
connect(mpa_actions[ToggleFullscreenAction], &QAction::toggled,
|
||||||
@ -399,11 +398,11 @@ void KiwixApp::createAction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void KiwixApp::postInit() {
|
void KiwixApp::postInit() {
|
||||||
connect(mp_tabWidget, &TabBar::webActionEnabledChanged,
|
connect(getTabWidget(), &TabBar::webActionEnabledChanged,
|
||||||
mp_mainWindow->getTopWidget(), &TopWidget::handleWebActionEnabledChanged);
|
mp_mainWindow->getTopWidget(), &TopWidget::handleWebActionEnabledChanged);
|
||||||
connect(mp_tabWidget, &TabBar::currentTitleChanged, this,
|
connect(getTabWidget(), &TabBar::currentTitleChanged, this,
|
||||||
[=](const QString& title) { emit currentTitleChanged(title); });
|
[=](const QString& title) { emit currentTitleChanged(title); });
|
||||||
connect(mp_tabWidget, &TabBar::libraryPageDisplayed,
|
connect(getTabWidget(), &TabBar::libraryPageDisplayed,
|
||||||
this, &KiwixApp::disableItemsOnLibraryPage);
|
this, &KiwixApp::disableItemsOnLibraryPage);
|
||||||
emit(m_library.booksChanged());
|
emit(m_library.booksChanged());
|
||||||
connect(&m_library, &Library::booksChanged, this, &KiwixApp::updateNameMapper);
|
connect(&m_library, &Library::booksChanged, this, &KiwixApp::updateNameMapper);
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
MainWindow* getMainWindow() { return mp_mainWindow; }
|
MainWindow* getMainWindow() { return mp_mainWindow; }
|
||||||
ContentManager* getContentManager() { return mp_manager; }
|
ContentManager* getContentManager() { return mp_manager; }
|
||||||
kiwix::Downloader* getDownloader() { return mp_downloader; }
|
kiwix::Downloader* getDownloader() { return mp_downloader; }
|
||||||
TabBar* getTabWidget() { return mp_tabWidget; }
|
TabBar* getTabWidget() { return getMainWindow()->getTabBar(); }
|
||||||
QAction* getAction(Actions action);
|
QAction* getAction(Actions action);
|
||||||
QString getLibraryDirectory() { return m_libraryDirectory; };
|
QString getLibraryDirectory() { return m_libraryDirectory; };
|
||||||
kiwix::Server* getLocalServer() { return &m_server; }
|
kiwix::Server* getLocalServer() { return &m_server; }
|
||||||
@ -108,7 +108,6 @@ private:
|
|||||||
kiwix::Downloader* mp_downloader;
|
kiwix::Downloader* mp_downloader;
|
||||||
ContentManager* mp_manager;
|
ContentManager* mp_manager;
|
||||||
MainWindow* mp_mainWindow;
|
MainWindow* mp_mainWindow;
|
||||||
TabBar* mp_tabWidget;
|
|
||||||
QErrorMessage* mp_errorDialog;
|
QErrorMessage* mp_errorDialog;
|
||||||
kiwix::UpdatableNameMapper m_nameMapper;
|
kiwix::UpdatableNameMapper m_nameMapper;
|
||||||
kiwix::Server m_server;
|
kiwix::Server m_server;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user