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