SMILX  1.01
milxAssistant.cpp
1 /*=========================================================================
2  The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
3  ABN 41 687 119 230.
4  All rights reserved.
5 
6  Licensed under the CSIRO BSD 3-Clause License
7  You may not use this file except in compliance with the License.
8  You may obtain a copy of the License in the file LICENSE.md or at
9 
10  https://stash.csiro.au/projects/SMILI/repos/smili/browse/license.txt
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 =========================================================================*/
22 //Qt
23 #include <QApplication>
24 #include <QMainWindow>
25 #include <QWebView>
26 #include <QFile>
27 #include <QToolBar>
28 #include <QDebug>
29 
30 int main(int argc, char* argv[])
31 {
32  QApplication app(argc,argv);
33  QMainWindow Main;
34  Q_INIT_RESOURCE(smili);
35  QWebView *assistantView = new QWebView(&Main);
36 
37  QFile file(":/resources/index.html");
38  if(file.open(QIODevice::ReadOnly))
39  assistantView->setHtml(file.readAll());
40  else
41  qDebug() << "Failed reading documentation.";
42 // assistantView->setUrl(QUrl(":/resources/index.html"));
43  assistantView->setWindowTitle("SMILI Assistant");
44  Main.setCentralWidget(assistantView);
45  Main.setUnifiedTitleAndToolBarOnMac(true);
46  assistantView->show();
47 
48  //Connect
49 
50  //Quick setup toolbar
51  QToolBar *toolBar = Main.addToolBar(QObject::tr("Navigation"));
52  toolBar->addAction(assistantView->pageAction(QWebPage::Back));
53  toolBar->addAction(assistantView->pageAction(QWebPage::Forward));
54  toolBar->addAction(assistantView->pageAction(QWebPage::Reload));
55  toolBar->addAction(assistantView->pageAction(QWebPage::Stop));
56 
57  Main.setWindowTitle("SMILI Assistant");
58  Main.show();
59  app.processEvents();
60 
61  return app.exec();
62 }
int main(int argc, char *argv[])