mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Overload KiwixApp::instance()
to return a KiwixApp*
.
This commit is contained in:
parent
0359cde2d2
commit
1287c93368
@ -53,6 +53,10 @@ KiwixApp::~KiwixApp()
|
||||
delete mainWindow;
|
||||
}
|
||||
|
||||
KiwixApp *KiwixApp::instance()
|
||||
{
|
||||
return static_cast<KiwixApp*>(QApplication::instance());
|
||||
}
|
||||
|
||||
void KiwixApp::openZimFile(const QString &zimfile)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ class KiwixApp : public QApplication
|
||||
public:
|
||||
KiwixApp(int& argc, char *argv[]);
|
||||
virtual ~KiwixApp();
|
||||
static KiwixApp* instance();
|
||||
|
||||
void openZimFile(const QString& zimfile);
|
||||
|
||||
|
@ -20,7 +20,7 @@ KiwixSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request)
|
||||
qDebug() << "Handling request" << qurl;
|
||||
if (url[0] == '/')
|
||||
url = url.substr(1);
|
||||
auto library = static_cast<KiwixApp*>(KiwixApp::instance())->getLibrary();
|
||||
auto library = KiwixApp::instance()->getLibrary();
|
||||
auto zim_id = qurl.host();
|
||||
auto reader = library->getReader(zim_id);
|
||||
if ( reader == nullptr) {
|
||||
|
@ -8,7 +8,7 @@ KiwixWebView::KiwixWebView(QWidget *parent)
|
||||
: QWebEngineView(parent)
|
||||
{
|
||||
auto profile = page()->profile();
|
||||
auto app = static_cast<KiwixApp*>(KiwixApp::instance());
|
||||
auto app = KiwixApp::instance();
|
||||
profile->installUrlSchemeHandler("zim", app->getSchemeHandler());
|
||||
profile->setRequestInterceptor(app->getRequestInterceptor());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user