diff --git a/htmlarea.cpp b/htmlarea.cpp index 0340519..81f9b4a 100644 --- a/htmlarea.cpp +++ b/htmlarea.cpp @@ -108,7 +108,8 @@ void HtmlArea::setNewContent( int method, QString str = "" ){ //TODO build history, set Title //TODO certain zimfiles break here // example full german file breaks here with article "Trockenrasierer" - std::string content = article.getPage(); + std::string content = ""; + content.append(article.getPage()); this->setText(QString::fromUtf8(content.c_str())); log_debug("Text set"); @@ -152,6 +153,10 @@ void HtmlArea::searchArticle(QString term){ } } +void HtmlArea::goToTop(){ + this->scrollToAnchor("#top"); +} + // //////////////////////////////////////////// //////////////////////////////////////////// diff --git a/htmlarea.h b/htmlarea.h index 1bcd095..dcea3f8 100644 --- a/htmlarea.h +++ b/htmlarea.h @@ -56,4 +56,5 @@ class HtmlArea : public QTextBrowser void linking( const QUrl &txt ); void sourceChange( const QUrl &txt ); void getRandom(); + void goToTop(); }; diff --git a/moc_htmlarea.cpp b/moc_htmlarea.cpp index 35198a5..02afd2f 100644 --- a/moc_htmlarea.cpp +++ b/moc_htmlarea.cpp @@ -1,13 +1,20 @@ /**************************************************************************** ** Meta object code from reading C++ file 'htmlarea.h' ** -** Created: Wed Apr 7 16:52:55 2010 +** Created: Wed Apr 7 18:36:22 2010 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "htmlarea.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'htmlarea.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 61 +#error "This file was generated using the moc from 4.5.2. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_UserEventFilter[] = { @@ -59,7 +66,7 @@ static const uint qt_meta_data_HtmlArea[] = { 2, // revision 0, // classname 0, 0, // classinfo - 3, 12, // methods + 4, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -68,13 +75,14 @@ static const uint qt_meta_data_HtmlArea[] = { 14, 10, 9, 9, 0x0a, 28, 10, 9, 9, 0x0a, 47, 9, 9, 9, 0x0a, + 59, 9, 9, 9, 0x0a, 0 // eod }; static const char qt_meta_stringdata_HtmlArea[] = { "HtmlArea\0\0txt\0linking(QUrl)\0" - "sourceChange(QUrl)\0getRandom()\0" + "sourceChange(QUrl)\0getRandom()\0goToTop()\0" }; const QMetaObject HtmlArea::staticMetaObject = { @@ -105,9 +113,10 @@ int HtmlArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 0: linking((*reinterpret_cast< const QUrl(*)>(_a[1]))); break; case 1: sourceChange((*reinterpret_cast< const QUrl(*)>(_a[1]))); break; case 2: getRandom(); break; + case 3: goToTop(); break; default: ; } - _id -= 3; + _id -= 4; } return _id; } diff --git a/moc_qmain.cpp b/moc_qmain.cpp index 55b4e6f..b460288 100644 --- a/moc_qmain.cpp +++ b/moc_qmain.cpp @@ -1,13 +1,20 @@ /**************************************************************************** ** Meta object code from reading C++ file 'qmain.h' ** -** Created: Wed Apr 7 16:52:55 2010 +** Created: Wed Apr 7 18:36:22 2010 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "qmain.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'qmain.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 61 +#error "This file was generated using the moc from 4.5.2. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_QMain[] = { diff --git a/qmain.cpp b/qmain.cpp index 5cd0886..15c435d 100644 --- a/qmain.cpp +++ b/qmain.cpp @@ -71,11 +71,25 @@ void QMain::registerCommands() this->addAction(searchArticleAct); //display help - displayHelpAct = new QAction(tr("Display &H"), this); + displayHelpAct = new QAction(tr("Display &Help"), this); displayHelpAct->setShortcut(tr("F1")); displayHelpAct->setStatusTip(tr("Display Help")); connect(displayHelpAct, SIGNAL(triggered()), this, SLOT(displayHelp())); this->addAction(displayHelpAct); + + //go to top + goToTopAct = new QAction(tr("Display &Help"), this); + goToTopAct->setShortcut(tr("Ctrl+T")); + goToTopAct->setStatusTip(tr("Display Help")); + connect(goToTopAct, SIGNAL(triggered()), this->centralWidget, SLOT(goToTop())); + this->addAction(goToTopAct); + + // quit qvid0 + quitAct = new QAction(tr("Quit QVido"), this); + quitAct->setShortcut(tr("Ctrl+Q")); + quitAct->setStatusTip(tr("Quit")); + connect(quitAct, SIGNAL(triggered()), qApp, SLOT(quit())); + this->addAction(quitAct); } void QMain::displayHelp(){ @@ -85,9 +99,9 @@ void QMain::displayHelp(){ txt.append("Ctrl + T = Go to articles top\n"); txt.append("Tab = Rotate through links\n"); txt.append("Enter = Activate link\n"); - txt.append("Ctrl + H = Display history\n"); - txt.append("Ctrl + B = Go back in history\n"); - txt.append("Ctrl + F = Go forward in history\n"); +// txt.append("Ctrl + H = Display history\n"); +// txt.append("Ctrl + B = Go back in history\n"); +// txt.append("Ctrl + F = Go forward in history\n"); txt.append("Ctrl + Q = Quit Vido\n"); txt.append("F1 = Display this help\n"); diff --git a/qmain.h b/qmain.h index 2fc288e..cd3c8ec 100644 --- a/qmain.h +++ b/qmain.h @@ -41,6 +41,8 @@ private: QAction *randomArticleAct; QAction *searchArticleAct; QAction *displayHelpAct; + QAction *quitAct; + QAction *goToTopAct; private Q_SLOTS: void displayHelp();