File indexing completed on 2023-05-30 10:45:27

0001 /*
0002     SPDX-FileCopyrightText: 2010 Peter Hedlund <peter.hedlund@kdemail.net>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef KWQTUTOR_H
0007 #define KWQTUTOR_H
0008 
0009 #include <KActionCollection>
0010 #include <KStatusNotifierItem>
0011 
0012 #include "keduvocdocument.h"
0013 #include "kwqtutorflashcard.h"
0014 
0015 class KWQTutor : public KStatusNotifierItem
0016 {
0017   Q_OBJECT
0018 
0019   public:
0020     /* init systray icon, meny, actions */
0021     explicit KWQTutor (const QUrl &fileToOpen, QWidget *parent = nullptr);
0022     ~KWQTutor() override;
0023 
0024   public Q_SLOTS:
0025     /* self-calling function: it sets the time interval,calls itself and call func to display flashcard*/
0026     void updateTimer();
0027     /*open keduvocdocument from the menu */
0028     void loadFile();
0029     /* show the Preferences menu and save changes on closing */
0030     void showPrefMenu();
0031     /* starts or stops the exercise */
0032     void startStopPressed ();
0033     /*displays the flashcard */
0034     void showFlashcard(int numberShowing);
0035     /* shows the reverse side of the flashcard being displayed */
0036     void flipFlashcard();
0037     /* closes the flashcard*/
0038     void closeFlashcard();
0039     /* save preferences before exit */
0040     void quit();
0041     /* apply any new preferences */
0042     void slotApplyPreferences();
0043 
0044   private:
0045     /* random number generator*/
0046     /* an entry of KEduVocDocument which is currently being displayed in flashcard */
0047     int m_currentEntry;
0048     int m_currentColumn;
0049     /* the actual popup flashcard*/
0050     KWQTutorFlashCard* m_flashcard;
0051     /* the timer which launches flashcards after certain intervals */
0052     QTimer * m_timer;
0053     /* the vocabulary doc being opened */
0054     KEduVocDocument* m_tutorDoc;
0055     /* collection of QAction that holds Global Shortcuts */
0056     KActionCollection* m_globalCollection;
0057     /* tutor start action */
0058     QAction* m_tutorStartAction;
0059     /* a flag to know whether the tutor exercise is runnig */
0060     bool m_isRunning;
0061 };
0062 
0063 #endif // KWQTUTOR_H