Date:2010-04-07 18:37:42 (10 years 4 months ago)
Author:Mirko Lindner
Commit:f06a95726a3722e6d75517b6561fc8e155e33333
Message:add quit and goToTop actions

Signed-off-by: Mirko Lindner <mirko@sharism.cc>
Files: htmlarea.cpp (2 diffs)
htmlarea.h (1 diff)
moc_htmlarea.cpp (4 diffs)
moc_qmain.cpp (1 diff)
qmain.cpp (2 diffs)
qmain.h (1 diff)

Change Details

htmlarea.cpp
108108        //TODO build history, set Title
109109        //TODO certain zimfiles break here
110110        // example full german file breaks here with article "Trockenrasierer"
111        std::string content = article.getPage();
111        std::string content = "<a name=\"top\"></a>";
112        content.append(article.getPage());
112113        this->setText(QString::fromUtf8(content.c_str()));
113114
114115        log_debug("Text set");
...... 
152153    }
153154}
154155
156void HtmlArea::goToTop(){
157    this->scrollToAnchor("#top");
158}
159
155160//
156161////////////////////////////////////////////
157162////////////////////////////////////////////
htmlarea.h
5656        void linking( const QUrl &txt );
5757        void sourceChange( const QUrl &txt );
5858        void getRandom();
59        void goToTop();
5960};
moc_htmlarea.cpp
11/****************************************************************************
22** Meta object code from reading C++ file 'htmlarea.h'
33**
4** Created: Wed Apr 7 16:52:55 2010
4** Created: Wed Apr 7 18:36:22 2010
55** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
66**
77** WARNING! All changes made in this file will be lost!
88*****************************************************************************/
99
1010#include "htmlarea.h"
11#if !defined(Q_MOC_OUTPUT_REVISION)
12#error "The header file 'htmlarea.h' doesn't include <QObject>."
13#elif Q_MOC_OUTPUT_REVISION != 61
14#error "This file was generated using the moc from 4.5.2. It"
15#error "cannot be used with the include files from this version of Qt."
16#error "(The moc has changed too much.)"
17#endif
1118
1219QT_BEGIN_MOC_NAMESPACE
1320static const uint qt_meta_data_UserEventFilter[] = {
...... 
5966       2, // revision
6067       0, // classname
6168       0, 0, // classinfo
62       3, 12, // methods
69       4, 12, // methods
6370       0, 0, // properties
6471       0, 0, // enums/sets
6572       0, 0, // constructors
...... 
6875      14, 10, 9, 9, 0x0a,
6976      28, 10, 9, 9, 0x0a,
7077      47, 9, 9, 9, 0x0a,
78      59, 9, 9, 9, 0x0a,
7179
7280       0 // eod
7381};
7482
7583static const char qt_meta_stringdata_HtmlArea[] = {
7684    "HtmlArea\0\0txt\0linking(QUrl)\0"
77    "sourceChange(QUrl)\0getRandom()\0"
85    "sourceChange(QUrl)\0getRandom()\0goToTop()\0"
7886};
7987
8088const QMetaObject HtmlArea::staticMetaObject = {
...... 
105113        case 0: linking((*reinterpret_cast< const QUrl(*)>(_a[1]))); break;
106114        case 1: sourceChange((*reinterpret_cast< const QUrl(*)>(_a[1]))); break;
107115        case 2: getRandom(); break;
116        case 3: goToTop(); break;
108117        default: ;
109118        }
110        _id -= 3;
119        _id -= 4;
111120    }
112121    return _id;
113122}
moc_qmain.cpp
11/****************************************************************************
22** Meta object code from reading C++ file 'qmain.h'
33**
4** Created: Wed Apr 7 16:52:55 2010
4** Created: Wed Apr 7 18:36:22 2010
55** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
66**
77** WARNING! All changes made in this file will be lost!
88*****************************************************************************/
99
1010#include "qmain.h"
11#if !defined(Q_MOC_OUTPUT_REVISION)
12#error "The header file 'qmain.h' doesn't include <QObject>."
13#elif Q_MOC_OUTPUT_REVISION != 61
14#error "This file was generated using the moc from 4.5.2. It"
15#error "cannot be used with the include files from this version of Qt."
16#error "(The moc has changed too much.)"
17#endif
1118
1219QT_BEGIN_MOC_NAMESPACE
1320static const uint qt_meta_data_QMain[] = {
qmain.cpp
7171        this->addAction(searchArticleAct);
7272
7373        //display help
74        displayHelpAct = new QAction(tr("Display &H"), this);
74        displayHelpAct = new QAction(tr("Display &Help"), this);
7575        displayHelpAct->setShortcut(tr("F1"));
7676        displayHelpAct->setStatusTip(tr("Display Help"));
7777        connect(displayHelpAct, SIGNAL(triggered()), this, SLOT(displayHelp()));
7878        this->addAction(displayHelpAct);
79
80        //go to top
81        goToTopAct = new QAction(tr("Display &Help"), this);
82        goToTopAct->setShortcut(tr("Ctrl+T"));
83        goToTopAct->setStatusTip(tr("Display Help"));
84        connect(goToTopAct, SIGNAL(triggered()), this->centralWidget, SLOT(goToTop()));
85        this->addAction(goToTopAct);
86
87        // quit qvid0
88        quitAct = new QAction(tr("Quit QVido"), this);
89        quitAct->setShortcut(tr("Ctrl+Q"));
90        quitAct->setStatusTip(tr("Quit"));
91        connect(quitAct, SIGNAL(triggered()), qApp, SLOT(quit()));
92        this->addAction(quitAct);
7993}
8094
8195void QMain::displayHelp(){
...... 
8599    txt.append("Ctrl + T = Go to articles top\n");
86100    txt.append("Tab = Rotate through links\n");
87101    txt.append("Enter = Activate link\n");
88    txt.append("Ctrl + H = Display history\n");
89    txt.append("Ctrl + B = Go back in history\n");
90    txt.append("Ctrl + F = Go forward in history\n");
102// txt.append("Ctrl + H = Display history\n");
103// txt.append("Ctrl + B = Go back in history\n");
104// txt.append("Ctrl + F = Go forward in history\n");
91105    txt.append("Ctrl + Q = Quit Vido\n");
92106    txt.append("F1 = Display this help\n");
93107
qmain.h
4141        QAction *randomArticleAct;
4242        QAction *searchArticleAct;
4343        QAction *displayHelpAct;
44        QAction *quitAct;
45        QAction *goToTopAct;
4446
4547private Q_SLOTS:
4648        void displayHelp();

Archive Download the corresponding diff file

Branches:
master



interactive