[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Wed, 30 Nov 2022 13:36:35 -0500 (EST) |
branch: old/qt-info
commit 6c9bfc67d7a9aa5e51e40165a8eaa046ff5bb629
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 7 16:05:06 2019 +0100
load the manual the user chose
---
js/docbrowser/mainwindow.cpp | 24 +++++++++++++++---------
js/docbrowser/mainwindow.h | 3 +--
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/js/docbrowser/mainwindow.cpp b/js/docbrowser/mainwindow.cpp
index b9c95502d7..982a7b1687 100644
--- a/js/docbrowser/mainwindow.cpp
+++ b/js/docbrowser/mainwindow.cpp
@@ -58,7 +58,8 @@ MainWindow::MainWindow(QWidget *parent) :
QByteArray b = file.readAll();
this->qwebchannel_js = QString(b);
- load_manual();
+#define MANUAL "hello-html"
+ load_manual (MANUAL);
}
/* Load qwebchannel.js into the current page. */
@@ -82,13 +83,20 @@ MainWindow::inject_qwebchannel(bool finished_ok)
}
-#define MANUAL "hello-html"
-void
-MainWindow::load_manual()
+bool
+MainWindow::load_manual (const char *manual)
{
- ui->webEngineView->load(QUrl("file:"
-+ QString(this->datadir) + "/examples/" MANUAL "/index.html"));
+ char *path = locate_manual (manual);
+
+ if (path)
+ {
+ qDebug() << "got path" << path;
+ ui->webEngineView->load(QUrl("file:" + QString(path)));
+ free (path);
+ return true;
+ }
+ return false;
}
MainWindow::~MainWindow()
@@ -109,7 +117,5 @@ void MainWindow::on_quitButton_clicked()
void MainWindow::on_loadButton_clicked()
{
- qDebug() << "load clicked";
- char *path = locate_manual(qPrintable(ui->manualEdit->text()));
- qDebug() << "got path" << path;
+ load_manual (qPrintable(ui->manualEdit->text()));
}
diff --git a/js/docbrowser/mainwindow.h b/js/docbrowser/mainwindow.h
index e213da1c6d..f8a845ab79 100644
--- a/js/docbrowser/mainwindow.h
+++ b/js/docbrowser/mainwindow.h
@@ -24,7 +24,6 @@ private slots:
void on_quitButton_clicked();
void on_loadButton_clicked();
-
private:
Ui::MainWindow *ui;
@@ -33,7 +32,7 @@ private:
QString qwebchannel_js;
char *datadir;
- void load_manual();
+ bool load_manual (const char *manual);
void quit();
void inject_qwebchannel(bool ok);
};
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject],
Gavin D. Smith <=
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30