1
0
mirror of git://projects.qi-hardware.com/qvido.git synced 2024-12-22 09:35:12 +02:00

add quit and goToTop actions

Signed-off-by: Mirko Lindner <mirko@sharism.cc>
This commit is contained in:
Mirko Lindner 2010-04-07 18:37:42 +02:00
parent 6fa65b6a63
commit f06a95726a
6 changed files with 48 additions and 10 deletions

View File

@ -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 = "<a name=\"top\"></a>";
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");
}
//
////////////////////////////////////////////
////////////////////////////////////////////

View File

@ -56,4 +56,5 @@ class HtmlArea : public QTextBrowser
void linking( const QUrl &txt );
void sourceChange( const QUrl &txt );
void getRandom();
void goToTop();
};

View File

@ -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 <QObject>."
#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;
}

View File

@ -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 <QObject>."
#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[] = {

View File

@ -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");

View File

@ -41,6 +41,8 @@ private:
QAction *randomArticleAct;
QAction *searchArticleAct;
QAction *displayHelpAct;
QAction *quitAct;
QAction *goToTopAct;
private Q_SLOTS:
void displayHelp();