├── img ├── data.png ├── key.png ├── play.png ├── plus.png ├── save.png ├── text.png ├── wait.png ├── check.png ├── cursor.png ├── pinned.png ├── scroll.png ├── close_red.png ├── crosshair.png ├── darkTheme.png ├── key_light.png ├── noscroll.png ├── shortcut.png ├── startup.png ├── unpinned.png ├── up_arrow.png ├── anotherTask.png ├── check_light.png ├── data_light.png ├── down_arrow.png ├── left_arrow.png ├── lightTheme.png ├── programIcon.ico ├── programIcon.png ├── right_arrow.png ├── save_light.png ├── text_light.png ├── wait_light.png ├── browseFolder.png ├── cursor-cross.png ├── cursor_light.png ├── shortcut_light.png ├── startup_light.png ├── systemCommand.png ├── up_arrow_light.png ├── close_red_light.png ├── down_arrow_light.png ├── left_arrow_light.png ├── up_arrow_rounded.png ├── anotherTask_light.png ├── browseFolder_light.png ├── down_arrow_rounded.png ├── right_arrow_light.png ├── systemCommand_light.png ├── top_arrow_rounded.png ├── bottom_arrow_rounded.png ├── down_arrow_rounded_light.png ├── top_arrow_rounded_light.png ├── up_arrow_rounded_light.png └── bottom_arrow_rounded_light.png ├── actions ├── AbstractAction.cpp ├── WaitAction.h ├── WaitAction.cpp ├── PasteAction.h ├── RunningOtherTaskAction.h ├── CursorMovementsAction.h ├── KeysSequenceAction.h ├── AbstractAction.h ├── RunningOtherTaskAction.cpp ├── PasteAction.cpp ├── ActionsTools.h ├── SystemCommandsAction.h ├── ActionParameters.h ├── CursorMovementsAction.cpp └── KeysSequenceAction.cpp ├── Task.cpp ├── ui ├── various_dialogs │ ├── DataEditDialog.h │ ├── StartupTasksDialog.h │ ├── StartupTaskEditDialog.h │ ├── KeysSelectorDialog.h │ ├── CreateAutorunDesktopShortcutDialog.h │ ├── StartupTasksDialog.cpp │ ├── CreateLoadTaskDialog.h │ ├── KeysSelectorDialog.cpp │ ├── DataEditDialog.cpp │ ├── StartupTaskEditDialog.cpp │ └── CreateAutorunDesktopShortcutDialog.cpp ├── getdialogs │ ├── getCursorCoordinatesWidget.h │ ├── getImagePathDialog.h │ ├── getFolderPathDialog.h │ ├── getProgramPathDialog.h │ ├── getAutoRenameOptionDialog.h │ ├── getFilePathDialog.h │ ├── getDelayDialog.h │ ├── getAutoRenameOptionDialog.cpp │ ├── getImagePathDialog.cpp │ ├── getProgramPathDialog.cpp │ ├── getFolderPathDialog.cpp │ ├── getFilePathDialog.cpp │ ├── getCursorCoordinatesWidget.cpp │ ├── getAutoRenameOptionDialog.ui │ ├── getDelayDialog.cpp │ ├── getImagePathDialog.ui │ ├── getFilePathDialog.ui │ ├── getProgramPathDialog.ui │ └── getFolderPathDialog.ui ├── createactiondialogs │ ├── CreatePasteActionDialog.h │ ├── CreateKeysSequenceActionDialog.h │ ├── CreateWaitActionDialog.h │ ├── CreateCursorMovementsActionDialog.h │ ├── CreateRunningOtherTaskActionDialog.h │ ├── CreateSystemCommandActionDialog.h │ ├── CreatePasteActionDialog.cpp │ ├── CreateKeysSequenceActionDialog.cpp │ ├── CreateCursorMovementsActionDialog.cpp │ ├── CreateWaitActionDialog.cpp │ └── CreateRunningOtherTaskActionDialog.cpp ├── actionwidgets │ ├── WaitWidget.h │ ├── RunningOtherTaskWidget.h │ ├── SystemCommandWidget.h │ ├── PasteWidget.h │ ├── KeysSequenceWidget.h │ ├── CursorMovementsWidget.h │ ├── AbstractActionWidget.h │ ├── RunningOtherTaskWidget.cpp │ ├── WaitWidget.cpp │ ├── SystemCommandWidget.cpp │ ├── PasteWidget.cpp │ ├── KeysSequenceWidget.cpp │ ├── CursorMovementsWidget.cpp │ └── AbstractActionWidget.cpp ├── editselectedactiondialogs │ ├── SentenceSelectedEditDialog.h │ ├── KeysSequenceSelectedEditDialog.h │ ├── CursorMovementsSelectedEditDialog.h │ ├── SentenceSelectedEditDialog.cpp │ └── SentenceSelectedEditDialog.ui ├── tablewidgets │ ├── SentencesTableWidget.h │ ├── KeysSequencesTableWidget.h │ ├── CursorMovementsTableWidget.h │ ├── StartupTasksTableWidget.h │ ├── SentencesTableWidget.cpp │ ├── KeysSequencesTableWidget.cpp │ └── CursorMovementsTableWidget.cpp ├── CustomPrimaryWidgets.h └── Tasktab.h ├── Task.h ├── TaskThread.h ├── ActionWidgetsManager.h ├── private_policy.txt ├── TaskThread.cpp ├── TaskTabsManager.h ├── readme.txt ├── resources.qrc ├── main.cpp ├── README.md ├── ActionWidgetsManager.cpp ├── mainwindow.h ├── globals.h └── ScheduledPasteAndKeys.pro /img/data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/data.png -------------------------------------------------------------------------------- /img/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/key.png -------------------------------------------------------------------------------- /img/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/play.png -------------------------------------------------------------------------------- /img/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/plus.png -------------------------------------------------------------------------------- /img/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/save.png -------------------------------------------------------------------------------- /img/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/text.png -------------------------------------------------------------------------------- /img/wait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/wait.png -------------------------------------------------------------------------------- /img/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/check.png -------------------------------------------------------------------------------- /img/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/cursor.png -------------------------------------------------------------------------------- /img/pinned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/pinned.png -------------------------------------------------------------------------------- /img/scroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/scroll.png -------------------------------------------------------------------------------- /img/close_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/close_red.png -------------------------------------------------------------------------------- /img/crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/crosshair.png -------------------------------------------------------------------------------- /img/darkTheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/darkTheme.png -------------------------------------------------------------------------------- /img/key_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/key_light.png -------------------------------------------------------------------------------- /img/noscroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/noscroll.png -------------------------------------------------------------------------------- /img/shortcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/shortcut.png -------------------------------------------------------------------------------- /img/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/startup.png -------------------------------------------------------------------------------- /img/unpinned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/unpinned.png -------------------------------------------------------------------------------- /img/up_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/up_arrow.png -------------------------------------------------------------------------------- /img/anotherTask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/anotherTask.png -------------------------------------------------------------------------------- /img/check_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/check_light.png -------------------------------------------------------------------------------- /img/data_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/data_light.png -------------------------------------------------------------------------------- /img/down_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/down_arrow.png -------------------------------------------------------------------------------- /img/left_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/left_arrow.png -------------------------------------------------------------------------------- /img/lightTheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/lightTheme.png -------------------------------------------------------------------------------- /img/programIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/programIcon.ico -------------------------------------------------------------------------------- /img/programIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/programIcon.png -------------------------------------------------------------------------------- /img/right_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/right_arrow.png -------------------------------------------------------------------------------- /img/save_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/save_light.png -------------------------------------------------------------------------------- /img/text_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/text_light.png -------------------------------------------------------------------------------- /img/wait_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/wait_light.png -------------------------------------------------------------------------------- /img/browseFolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/browseFolder.png -------------------------------------------------------------------------------- /img/cursor-cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/cursor-cross.png -------------------------------------------------------------------------------- /img/cursor_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/cursor_light.png -------------------------------------------------------------------------------- /img/shortcut_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/shortcut_light.png -------------------------------------------------------------------------------- /img/startup_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/startup_light.png -------------------------------------------------------------------------------- /img/systemCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/systemCommand.png -------------------------------------------------------------------------------- /img/up_arrow_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/up_arrow_light.png -------------------------------------------------------------------------------- /img/close_red_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/close_red_light.png -------------------------------------------------------------------------------- /img/down_arrow_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/down_arrow_light.png -------------------------------------------------------------------------------- /img/left_arrow_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/left_arrow_light.png -------------------------------------------------------------------------------- /img/up_arrow_rounded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/up_arrow_rounded.png -------------------------------------------------------------------------------- /img/anotherTask_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/anotherTask_light.png -------------------------------------------------------------------------------- /img/browseFolder_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/browseFolder_light.png -------------------------------------------------------------------------------- /img/down_arrow_rounded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/down_arrow_rounded.png -------------------------------------------------------------------------------- /img/right_arrow_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/right_arrow_light.png -------------------------------------------------------------------------------- /img/systemCommand_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/systemCommand_light.png -------------------------------------------------------------------------------- /img/top_arrow_rounded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/top_arrow_rounded.png -------------------------------------------------------------------------------- /img/bottom_arrow_rounded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/bottom_arrow_rounded.png -------------------------------------------------------------------------------- /img/down_arrow_rounded_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/down_arrow_rounded_light.png -------------------------------------------------------------------------------- /img/top_arrow_rounded_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/top_arrow_rounded_light.png -------------------------------------------------------------------------------- /img/up_arrow_rounded_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/up_arrow_rounded_light.png -------------------------------------------------------------------------------- /img/bottom_arrow_rounded_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirHammouteneEI/ScheduledPasteAndKeys/HEAD/img/bottom_arrow_rounded_light.png -------------------------------------------------------------------------------- /actions/AbstractAction.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractAction.h" 2 | 3 | unsigned int AbstractAction::s_idCounter = 0; 4 | 5 | AbstractAction::AbstractAction() 6 | { 7 | e_type = ActionType::Undefined; 8 | m_ID = ++s_idCounter; // No action with id = 0 9 | } 10 | -------------------------------------------------------------------------------- /Task.cpp: -------------------------------------------------------------------------------- 1 | #include "Task.h" 2 | 3 | Task::Task() 4 | {} 5 | 6 | Task::~Task() 7 | { 8 | m_actionsMap.clear(); 9 | m_actionsOrderedList.clear(); 10 | } 11 | 12 | int Task::appendAction(const std::shared_ptr &act) 13 | { 14 | if(act != nullptr) 15 | { 16 | m_actionsMap.insert(act->getID(), act); 17 | m_actionsOrderedList.append(act); 18 | } 19 | 20 | return m_actionsMap.size(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /ui/various_dialogs/DataEditDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef DATAEDITDIALOG_H 2 | #define DATAEDITDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class DataEditDialog; 8 | } 9 | 10 | class DataEditDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit DataEditDialog(QWidget *parent = nullptr); 16 | ~DataEditDialog(); 17 | public slots: 18 | void showDialog(); 19 | 20 | private: 21 | Ui::DataEditDialog *ui; 22 | }; 23 | 24 | #endif // DATAEDITDIALOG_H 25 | -------------------------------------------------------------------------------- /ui/various_dialogs/StartupTasksDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef STARTUPTASKSDIALOG_H 2 | #define STARTUPTASKSDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class StartupTasksDialog; 8 | } 9 | 10 | class StartupTasksDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit StartupTasksDialog(QWidget *parent = nullptr); 16 | ~StartupTasksDialog(); 17 | public slots: 18 | void showDialog(); 19 | private: 20 | Ui::StartupTasksDialog *ui; 21 | }; 22 | 23 | #endif // STARTUPTASKSDIALOG_H 24 | -------------------------------------------------------------------------------- /Task.h: -------------------------------------------------------------------------------- 1 | #ifndef TASK_H 2 | #define TASK_H 3 | 4 | #include "actions/AbstractAction.h" 5 | 6 | #include 7 | #include 8 | 9 | class Task 10 | { 11 | QMap> m_actionsMap; 12 | QList> m_actionsOrderedList; 13 | public: 14 | explicit Task(); 15 | ~Task(); 16 | int appendAction(const std::shared_ptr &act); 17 | 18 | friend class TaskThread; 19 | friend class TaskTab; 20 | friend class TaskTabsManager; 21 | }; 22 | 23 | #endif // TASK_H 24 | -------------------------------------------------------------------------------- /ui/getdialogs/getCursorCoordinatesWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef GETCURSORCOORDINATESWIDGET_H 2 | #define GETCURSORCOORDINATESWIDGET_H 3 | 4 | #include 5 | #include 6 | 7 | class getCursorCoordinatesWidget : public QDialog 8 | { 9 | Q_OBJECT 10 | int m_refIndex = 0; 11 | public: 12 | explicit getCursorCoordinatesWidget(QWidget *parent = nullptr); 13 | ~getCursorCoordinatesWidget(); 14 | public slots: 15 | void showWidget(); 16 | protected: 17 | void mouseReleaseEvent(QMouseEvent*ev) override; 18 | signals: 19 | void sendCoordinates(int index, int x, int y); 20 | }; 21 | 22 | #endif // GETCURSORCOORDINATESWIDGET_H 23 | -------------------------------------------------------------------------------- /ui/getdialogs/getImagePathDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GETIMAGEPATHDIALOG_H 2 | #define GETIMAGEPATHDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class getImagePathDialog; 8 | } 9 | 10 | class getImagePathDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit getImagePathDialog(QWidget *parent = nullptr); 16 | ~getImagePathDialog(); 17 | private slots: 18 | void showBrowseFilesDialog(); 19 | void accept() override; 20 | public slots: 21 | void showDialog(); 22 | signals: 23 | void sendImage(QString dir); 24 | private: 25 | Ui::getImagePathDialog *ui; 26 | }; 27 | 28 | #endif // GETIMAGEPATHDIALOG_H 29 | -------------------------------------------------------------------------------- /ui/getdialogs/getFolderPathDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GETFOLDERPATHDIALOG_H 2 | #define GETFOLDERPATHDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class getFolderPathDialog; 8 | } 9 | 10 | class getFolderPathDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit getFolderPathDialog(QWidget *parent = nullptr); 16 | ~getFolderPathDialog(); 17 | private slots: 18 | void showBrowseFoldersDialog(); 19 | void accept() override; 20 | public slots: 21 | void showDialog(); 22 | signals: 23 | void sendDirectory(QString dir); 24 | private: 25 | Ui::getFolderPathDialog *ui; 26 | }; 27 | 28 | #endif // GETFOLDERPATHDIALOG_H 29 | -------------------------------------------------------------------------------- /ui/getdialogs/getProgramPathDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GETPROGRAMPATHDIALOG_H 2 | #define GETPROGRAMPATHDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class getProgramPathDialog; 8 | } 9 | 10 | class getProgramPathDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit getProgramPathDialog(QWidget *parent = nullptr); 15 | ~getProgramPathDialog(); 16 | private slots: 17 | void showBrowseFilesDialog(); 18 | void accept() override; 19 | public slots: 20 | void showDialog(); 21 | signals: 22 | void sendProgram(QString dir); 23 | private: 24 | Ui::getProgramPathDialog *ui; 25 | }; 26 | 27 | #endif // GETPROGRAMPATHDIALOG_H 28 | -------------------------------------------------------------------------------- /ui/getdialogs/getAutoRenameOptionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GETAUTORENAMEOPTIONDIALOG_H 2 | #define GETAUTORENAMEOPTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class getAutoRenameOptionDialog; 8 | } 9 | 10 | class getAutoRenameOptionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit getAutoRenameOptionDialog(QWidget *parent = nullptr); 16 | ~getAutoRenameOptionDialog(); 17 | private slots: 18 | void accept() override; 19 | public slots: 20 | void showDialog(); 21 | signals: 22 | void sendAutorename(bool autorename); 23 | private: 24 | Ui::getAutoRenameOptionDialog *ui; 25 | }; 26 | 27 | #endif // GETAUTORENAMEOPTIONDIALOG_H 28 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreatePasteActionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATEPASTEACTIONDIALOG_H 2 | #define CREATEPASTEACTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreatePasteActionDialog; 8 | } 9 | 10 | class CreatePasteActionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreatePasteActionDialog(QWidget *parent = nullptr); 16 | ~CreatePasteActionDialog(); 17 | public slots: 18 | void showDialog(); 19 | private slots: 20 | void accept() override; 21 | signals: 22 | void sendSentence(QString sentenceIdentity); 23 | 24 | private: 25 | Ui::CreatePasteActionDialog *ui; 26 | }; 27 | 28 | #endif // CREATEPASTEACTIONDIALOG_H 29 | -------------------------------------------------------------------------------- /ui/getdialogs/getFilePathDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GETFILEPATHDIALOG_H 2 | #define GETFILEPATHDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class getFilePathDialog; 8 | } 9 | 10 | class getFilePathDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | bool m_getSavedFileName = false; 14 | public: 15 | explicit getFilePathDialog(QWidget *parent = nullptr, bool getSaved = false); 16 | ~getFilePathDialog(); 17 | private slots: 18 | void showBrowseFilesDialog(); 19 | void accept() override; 20 | public slots: 21 | void showDialog(); 22 | signals: 23 | void sendFile(QString dir); 24 | private: 25 | Ui::getFilePathDialog *ui; 26 | }; 27 | 28 | #endif // GETFILEPATHDIALOG_H 29 | -------------------------------------------------------------------------------- /ui/various_dialogs/StartupTaskEditDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef STARTUPTASKEDITDIALOG_H 2 | #define STARTUPTASKEDITDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class StartupTaskEditDialog; 8 | } 9 | 10 | class StartupTaskEditDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit StartupTaskEditDialog(QWidget *parent = nullptr); 16 | ~StartupTaskEditDialog(); 17 | QString m_filename; 18 | qint64 m_delay; 19 | int m_loopTimes; 20 | void showDialog(); 21 | private slots: 22 | void accept() override; 23 | void loopToggled(bool state); 24 | private: 25 | Ui::StartupTaskEditDialog *ui; 26 | void fillExistingTasksTable(); 27 | }; 28 | 29 | #endif // STARTUPTASKEDITDIALOG_H 30 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateKeysSequenceActionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATEKEYSSEQUENCEACTIONDIALOG_H 2 | #define CREATEKEYSSEQUENCEACTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreateKeysSequenceActionDialog; 8 | } 9 | 10 | class CreateKeysSequenceActionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreateKeysSequenceActionDialog(QWidget *parent = nullptr); 16 | ~CreateKeysSequenceActionDialog(); 17 | public slots: 18 | void showDialog(); 19 | private slots: 20 | void accept() override; 21 | signals: 22 | void sendKeysSequence(QString keysSeqIdentity); 23 | private: 24 | Ui::CreateKeysSequenceActionDialog *ui; 25 | }; 26 | 27 | #endif // CREATEKEYSSEQUENCEACTIONDIALOG_H 28 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateWaitActionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATEWAITACTIONDIALOG_H 2 | #define CREATEWAITACTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreateWaitActionDialog; 8 | } 9 | 10 | class CreateWaitActionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreateWaitActionDialog(QWidget *parent = nullptr); 16 | ~CreateWaitActionDialog(); 17 | private slots: 18 | void uncheckBySecondsGroup(); 19 | void uncheckByDayBasedGroup(); 20 | void accept() override; 21 | public slots: 22 | void showDialog(); 23 | signals: 24 | void sendDuration(long double durationInSeconds); 25 | private: 26 | Ui::CreateWaitActionDialog *ui; 27 | }; 28 | 29 | #endif // CREATEWAITACTIONDIALOG_H 30 | -------------------------------------------------------------------------------- /actions/WaitAction.h: -------------------------------------------------------------------------------- 1 | #ifndef WAITACTION_H 2 | #define WAITACTION_H 3 | 4 | #include "AbstractAction.h" 5 | 6 | class WaitAction : public AbstractAction 7 | { 8 | Q_OBJECT 9 | private: 10 | long double m_duration; // in seconds 11 | public: 12 | WaitAction(); 13 | ~WaitAction() = default; 14 | WaitAction(const WaitAction & other) = delete; 15 | WaitAction& operator=(const WaitAction & other) = delete; 16 | 17 | void runAction() override; 18 | void setParameters(const ActionParameters& param) override; 19 | std::shared_ptr deepCopy() const override; 20 | ActionParameters generateParameters() const override; 21 | void optionalProcesses() override {} 22 | 23 | friend class WaitWidget; 24 | }; 25 | 26 | #endif // WAITACTION_H 27 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateCursorMovementsActionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATECURSORMOVEMENTSACTIONDIALOG_H 2 | #define CREATECURSORMOVEMENTSACTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreateCursorMovementsActionDialog; 8 | } 9 | 10 | class CreateCursorMovementsActionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreateCursorMovementsActionDialog(QWidget *parent = nullptr); 16 | ~CreateCursorMovementsActionDialog(); 17 | public slots: 18 | void showDialog(); 19 | private slots: 20 | void accept() override; 21 | signals: 22 | void sendCursorMovements(QString cursorMovsIdentity); 23 | private: 24 | Ui::CreateCursorMovementsActionDialog *ui; 25 | }; 26 | 27 | #endif // CREATECURSORMOVEMENTSACTIONDIALOG_H 28 | -------------------------------------------------------------------------------- /ui/actionwidgets/WaitWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef WAITWIDGET_H 2 | #define WAITWIDGET_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | #include "ui/createactiondialogs/CreateWaitActionDialog.h" 6 | 7 | #include 8 | #include 9 | 10 | class WaitWidget : public AbstractActionWidget 11 | { 12 | Q_OBJECT 13 | void changedRunningState() override; 14 | CreateWaitActionDialog *m_editDurationDialog = nullptr; 15 | public: 16 | explicit WaitWidget(QWidget *parent = nullptr); 17 | ~WaitWidget() = default; 18 | void buildWidget() override; 19 | public slots: 20 | void durationReceived(long double dur); 21 | private slots: 22 | void refreshTimeRemainingText(const QDateTime& departureDate); 23 | signals: 24 | }; 25 | 26 | #endif // WAITWIDGET_H 27 | -------------------------------------------------------------------------------- /ui/editselectedactiondialogs/SentenceSelectedEditDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef SENTENCESELECTEDEDITDIALOG_H 2 | #define SENTENCESELECTEDEDITDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class SentenceSelectedEditDialog; 8 | } 9 | 10 | class SentenceSelectedEditDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit SentenceSelectedEditDialog(QWidget *parent = nullptr); 16 | ~SentenceSelectedEditDialog(); 17 | void setEditable(bool id); 18 | void setIdentity(const QString & id); 19 | QString identity(); 20 | void setContent(const QString & content); 21 | QString content(); 22 | private slots: 23 | void accept() override; 24 | private: 25 | Ui::SentenceSelectedEditDialog *ui; 26 | }; 27 | 28 | #endif // SENTENCESELECTEDEDITDIALOG_H 29 | -------------------------------------------------------------------------------- /ui/various_dialogs/KeysSelectorDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYSSELECTORDIALOG_H 2 | #define KEYSSELECTORDIALOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace Ui { 9 | class KeysSelectorDialog; 10 | } 11 | 12 | class KeysSelectorDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit KeysSelectorDialog(QWidget *parent = nullptr); 18 | ~KeysSelectorDialog(); 19 | private slots: 20 | void appendToList(QTreeWidgetItem *item, int); 21 | void removeFromList(QListWidgetItem* item); 22 | void accept() override; 23 | public slots: 24 | void showDialog(); 25 | signals: 26 | void sendKeysList(QStringList keysList); 27 | private: 28 | Ui::KeysSelectorDialog *ui; 29 | }; 30 | 31 | #endif // KEYSSELECTORDIALOG_H 32 | -------------------------------------------------------------------------------- /ui/getdialogs/getDelayDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GETDELAYDIALOG_H 2 | #define GETDELAYDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class getDelayDialog; 9 | } 10 | 11 | class getDelayDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit getDelayDialog(QWidget *parent = nullptr); 17 | ~getDelayDialog(); 18 | QTime m_savedDelayTimePart = QTime(0,1,0); 19 | int m_savedDelayDayPart = 0; 20 | private slots: 21 | void uncheckDelayGroup(); 22 | void uncheckDateGroup(); 23 | void accept() override; 24 | void refreshDateDelayDetails(const QDateTime &datet); 25 | public slots: 26 | void showDialog(); 27 | signals: 28 | void sendDelay(qint64 delayInSeconds); 29 | private: 30 | Ui::getDelayDialog *ui; 31 | }; 32 | 33 | #endif // GETDELAYDIALOG_H 34 | -------------------------------------------------------------------------------- /actions/WaitAction.cpp: -------------------------------------------------------------------------------- 1 | #include "WaitAction.h" 2 | #include 3 | 4 | #include 5 | 6 | WaitAction::WaitAction() : AbstractAction() 7 | { 8 | e_type = ActionType::Wait; 9 | } 10 | 11 | void WaitAction::runAction() 12 | { 13 | Sleep(m_duration*1000); 14 | } 15 | 16 | void WaitAction::setParameters(const ActionParameters ¶m) 17 | { 18 | m_duration = param.m_waitDuration; 19 | } 20 | 21 | std::shared_ptr WaitAction::deepCopy() const 22 | { 23 | auto actToReturn = std::make_shared(); 24 | actToReturn->m_duration = m_duration; 25 | actToReturn->m_refID = m_ID; 26 | return actToReturn; 27 | } 28 | 29 | ActionParameters WaitAction::generateParameters() const 30 | { 31 | ActionParameters param; 32 | param.m_waitDuration = m_duration; 33 | return param; 34 | } 35 | -------------------------------------------------------------------------------- /TaskThread.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKTHREAD_H 2 | #define TASKTHREAD_H 3 | 4 | #include "Task.h" 5 | 6 | #include 7 | 8 | class TaskThread : public QThread 9 | { 10 | Q_OBJECT 11 | QList> m_actionsList; 12 | public: 13 | explicit TaskThread(QObject *parent = nullptr); 14 | ~TaskThread(); 15 | private: 16 | void copyActionsList(const std::shared_ptr &task); 17 | bool m_loop = false; 18 | unsigned int m_timesToRun = 1; 19 | bool m_haveToStop = false; 20 | public slots: 21 | void stop(); 22 | protected: 23 | void run() override; 24 | 25 | signals: 26 | void sendRunningStateAct(unsigned int actId); 27 | void sendDoneStateAct(unsigned int actId); 28 | void sendFinishedOneLoop(); 29 | void sendFinishedAllLoops(); 30 | 31 | friend class TaskTab; 32 | }; 33 | 34 | #endif // TASKTHREAD_H 35 | -------------------------------------------------------------------------------- /ui/actionwidgets/RunningOtherTaskWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNINGOTHERTASKWIDGET_H 2 | #define RUNNINGOTHERTASKWIDGET_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | #include "actions/RunningOtherTaskAction.h" 6 | #include "ui/createactiondialogs/CreateRunningOtherTaskActionDialog.h" 7 | 8 | class RunningOtherTaskWidget : public AbstractActionWidget 9 | { 10 | Q_OBJECT 11 | void changedRunningState() override {}; 12 | CreateRunningOtherTaskActionDialog *m_editRunOtherTaskDialog = nullptr; 13 | public: 14 | explicit RunningOtherTaskWidget(QWidget *parent = nullptr); 15 | ~RunningOtherTaskWidget() = default; 16 | void buildWidget() override; 17 | public slots: 18 | void runningOtherTaskReceived(QString filename, int delay, int timesOfLoop); // not const & because it's a slot, will make copy evenif 19 | }; 20 | 21 | #endif // RUNNINGOTHERTASKWIDGET_H 22 | -------------------------------------------------------------------------------- /ui/getdialogs/getAutoRenameOptionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "getAutoRenameOptionDialog.h" 2 | #include "ui_getAutoRenameOptionDialog.h" 3 | #include 4 | 5 | getAutoRenameOptionDialog::getAutoRenameOptionDialog(QWidget *parent) 6 | : QDialog(parent) 7 | , ui(new Ui::getAutoRenameOptionDialog) 8 | { 9 | ui->setupUi(this); 10 | } 11 | 12 | getAutoRenameOptionDialog::~getAutoRenameOptionDialog() 13 | { 14 | delete ui; 15 | } 16 | 17 | void getAutoRenameOptionDialog::accept() 18 | { 19 | emit sendAutorename(ui->checkBox->isChecked()); 20 | 21 | QDialog::accept(); 22 | } 23 | 24 | void getAutoRenameOptionDialog::showDialog() 25 | { 26 | QDialog::show(); 27 | auto buttonSender = qobject_cast(sender()); 28 | if(buttonSender == nullptr) 29 | return; 30 | ui->checkBox->setChecked(buttonSender->text() == "Auto-rename if exists"); 31 | } 32 | -------------------------------------------------------------------------------- /actions/PasteAction.h: -------------------------------------------------------------------------------- 1 | #ifndef PASTEACTION_H 2 | #define PASTEACTION_H 3 | 4 | #include "AbstractAction.h" 5 | 6 | class PasteAction : public AbstractAction 7 | { 8 | Q_OBJECT 9 | private: 10 | QString m_content; 11 | QString m_contentId; 12 | int m_timesToRun = 1; 13 | public: 14 | PasteAction(); 15 | ~PasteAction() = default; 16 | PasteAction(const PasteAction & other) = delete; 17 | PasteAction& operator=(const PasteAction & other) = delete; 18 | 19 | void runAction() override; 20 | void setParameters(const ActionParameters& param) override; 21 | std::shared_ptr deepCopy() const override; 22 | ActionParameters generateParameters() const override; 23 | void optionalProcesses() override {} 24 | int computeOneExecutionDuration(); // in miliseconds 25 | 26 | friend class PasteWidget; 27 | }; 28 | 29 | #endif // PASTEACTION_H 30 | -------------------------------------------------------------------------------- /ui/tablewidgets/SentencesTableWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SENTENCESTABLEWIDGET_H 2 | #define SENTENCESTABLEWIDGET_H 3 | 4 | #include "ui/CustomPrimaryWidgets.h" 5 | #include "ui/editselectedactiondialogs/SentenceSelectedEditDialog.h" 6 | 7 | class SentencesTableWidget : public NoFocusCellTableWidget 8 | { 9 | Q_OBJECT 10 | SentenceSelectedEditDialog *m_sentenceEditDialog = nullptr; 11 | public: 12 | explicit SentencesTableWidget(QWidget *parent = nullptr); 13 | ~SentencesTableWidget() = default; 14 | void refresh(); 15 | void selectSentenceFromIdentity(const QString & id); 16 | bool m_belongsToDataEditDialog = false; 17 | public slots: 18 | void createSentenceReceived(); 19 | void removeSentenceReceived(); 20 | void editFromDialogReceived(); 21 | private slots: 22 | void editSentenceSelected(int row, int); 23 | signals: 24 | }; 25 | 26 | #endif // SENTENCESTABLEWIDGET_H 27 | -------------------------------------------------------------------------------- /ui/actionwidgets/SystemCommandWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSTEMCOMMANDWIDGET_H 2 | #define SYSTEMCOMMANDWIDGET_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | #include "actions/SystemCommandsAction.h" 6 | #include "ui/createactiondialogs/CreateSystemCommandActionDialog.h" 7 | 8 | class SystemCommandWidget : public AbstractActionWidget 9 | { 10 | Q_OBJECT 11 | void changedRunningState() override {}; 12 | CreateSystemCommandActionDialog *m_editSysCmdDialog = nullptr; 13 | public: 14 | explicit SystemCommandWidget(QWidget *parent = nullptr); 15 | ~SystemCommandWidget() = default; 16 | void buildWidget() override; 17 | public slots: 18 | void systemCommandReceived(QString sysCmdType, QString param1, QString param2); // not const & because it's a slot, will make copy evenif 19 | private: 20 | QString fromSysCmdTypeToDiplayedStr(SystemCommandType t); 21 | }; 22 | 23 | #endif // SYSTEMCOMMANDWIDGET_H 24 | -------------------------------------------------------------------------------- /ui/tablewidgets/KeysSequencesTableWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYSSEQUENCESTABLEWIDGET_H 2 | #define KEYSSEQUENCESTABLEWIDGET_H 3 | 4 | #include "ui/CustomPrimaryWidgets.h" 5 | #include "ui/editselectedactiondialogs/KeysSequenceSelectedEditDialog.h" 6 | 7 | class KeysSequencesTableWidget : public NoFocusCellTableWidget 8 | { 9 | Q_OBJECT 10 | KeysSequenceSelectedEditDialog *m_keysSequenceEditDialog = nullptr; 11 | public: 12 | explicit KeysSequencesTableWidget(QWidget *parent = nullptr); 13 | ~KeysSequencesTableWidget() = default; 14 | void refresh(); 15 | void selectKeysSequenceFromIdentity(const QString & id); 16 | bool m_belongsToDataEditDialog = false; 17 | public slots: 18 | void createKeysSequenceReceived(); 19 | void removeKeysSequenceReceived(); 20 | void editFromDialogReceived(); 21 | private slots: 22 | void editKeysSequenceSelected(int row, int); 23 | signals: 24 | }; 25 | 26 | #endif // KEYSSEQUENCESTABLEWIDGET_H 27 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateRunningOtherTaskActionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATERUNNINGOTHERTASKACTIONDIALOG_H 2 | #define CREATERUNNINGOTHERTASKACTIONDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreateRunningOtherTaskActionDialog; 8 | } 9 | 10 | class CreateRunningOtherTaskActionDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreateRunningOtherTaskActionDialog(QWidget *parent = nullptr); 16 | ~CreateRunningOtherTaskActionDialog(); 17 | QString m_filename; 18 | qint64 m_delay; 19 | int m_loopTimes; 20 | public slots: 21 | void showDialog(); 22 | private slots: 23 | void accept() override; 24 | void loopToggled(bool state); 25 | signals: 26 | void sendRunningOtherTask(QString filename, int delay, int loops); 27 | private: 28 | Ui::CreateRunningOtherTaskActionDialog *ui; 29 | void fillExistingTasksTable(); 30 | }; 31 | 32 | #endif // CREATERUNNINGOTHERTASKACTIONDIALOG_H 33 | -------------------------------------------------------------------------------- /ActionWidgetsManager.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTIONWIDGETSMANAGER_H 2 | #define ACTIONWIDGETSMANAGER_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | 6 | #include 7 | #include 8 | 9 | class ActionWidgetsManager : public QObject 10 | { 11 | Q_OBJECT 12 | QVBoxLayout *m_layout = nullptr; 13 | QMap m_actionWidgetsMap; 14 | QList m_actionWidgetsDisplayOrderedList; 15 | void fullRefreshActionWidgets(); 16 | public: 17 | explicit ActionWidgetsManager(QVBoxLayout *parent = nullptr); 18 | ~ActionWidgetsManager(); 19 | int appendWidget(AbstractActionWidget* actionWidget); 20 | void clear(); 21 | void taskStopped(); 22 | void taskScheduled(); 23 | public slots: 24 | void receivedActionRunningState(unsigned int id); 25 | void receivedActionDoneState(unsigned int id); 26 | 27 | friend class TaskTab; 28 | }; 29 | 30 | #endif // ACTIONWIDGETSMANAGER_H 31 | -------------------------------------------------------------------------------- /ui/tablewidgets/CursorMovementsTableWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef CURSORMOVEMENTSTABLEWIDGET_H 2 | #define CURSORMOVEMENTSTABLEWIDGET_H 3 | 4 | #include "ui/editselectedactiondialogs/CursorMovementsSelectedEditDialog.h" 5 | #include "ui/CustomPrimaryWidgets.h" 6 | 7 | class CursorMovementsTableWidget : public NoFocusCellTableWidget 8 | { 9 | Q_OBJECT 10 | CursorMovementsSelectedEditDialog *m_cursorMovementsEditDialog = nullptr; 11 | public: 12 | explicit CursorMovementsTableWidget(QWidget *parent = nullptr); 13 | ~CursorMovementsTableWidget() = default; 14 | void refresh(); 15 | void selectCursorMovementsFromIdentity(const QString & id); 16 | bool m_belongsToDataEditDialog = false; 17 | public slots: 18 | void createCursorMovementsReceived(); 19 | void removeCursorMovementsReceived(); 20 | void editFromDialogReceived(); 21 | private slots: 22 | void editCursorMovementsSelected(int row, int); 23 | }; 24 | 25 | #endif // CURSORMOVEMENTSTABLEWIDGET_H 26 | -------------------------------------------------------------------------------- /ui/actionwidgets/PasteWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PASTEWIDGET_H 2 | #define PASTEWIDGET_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | #include "ui/createactiondialogs/CreatePasteActionDialog.h" 6 | #include "ui/CustomPrimaryWidgets.h" 7 | #include 8 | 9 | class PasteWidget : public AbstractActionWidget 10 | { 11 | Q_OBJECT 12 | CreatePasteActionDialog *m_createPasteActionDialog = nullptr; 13 | NoWheelFocusSpinBox *m_loopSpin = nullptr; 14 | void changedRunningState() override; 15 | public: 16 | explicit PasteWidget(QWidget *parent = nullptr); 17 | ~PasteWidget() = default; 18 | void buildWidget() override; 19 | public slots: 20 | void sentenceIdentityReceived(QString id); // not const & because it's a slot, will make copy evenif 21 | private slots: 22 | void timesToRunChanged(int times); 23 | private: 24 | void refreshLoopsRemainingText(const QDateTime& departureDate); 25 | signals: 26 | }; 27 | 28 | #endif // PASTEWIDGET_H 29 | -------------------------------------------------------------------------------- /ui/various_dialogs/CreateAutorunDesktopShortcutDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATEAUTORUNDESKTOPSHORTCUTDIALOG_H 2 | #define CREATEAUTORUNDESKTOPSHORTCUTDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreateAutorunDesktopShortcutDialog; 8 | } 9 | 10 | class CreateAutorunDesktopShortcutDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreateAutorunDesktopShortcutDialog(QWidget *parent = nullptr); 16 | ~CreateAutorunDesktopShortcutDialog(); 17 | QString m_filename; 18 | qint64 m_delay; 19 | int m_loopTimes; 20 | QString m_shortcutname; 21 | void showDialog(); 22 | private slots: 23 | void accept() override; 24 | void loopToggled(bool state); 25 | void onFileSelected(); 26 | private: 27 | Ui::CreateAutorunDesktopShortcutDialog *ui; 28 | void fillExistingTasksTable(); 29 | bool doesFilenameContainForbiddenChar(const QString & filename); 30 | }; 31 | 32 | #endif // CREATEAUTORUNDESKTOPSHORTCUTDIALOG_H 33 | -------------------------------------------------------------------------------- /ui/tablewidgets/StartupTasksTableWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef STARTUPTASKSTABLEWIDGET_H 2 | #define STARTUPTASKSTABLEWIDGET_H 3 | 4 | #include "ui/CustomPrimaryWidgets.h" 5 | #include "ui/various_dialogs/StartupTaskEditDialog.h" 6 | 7 | class StartupTasksTableWidget : public NoFocusCellTableWidget 8 | { 9 | Q_OBJECT 10 | StartupTaskEditDialog *m_startupTaskEditDialog = nullptr; 11 | bool doesEntryExistsInRegistry(const QString & taskParam); 12 | void addEntryToRegistry(const QString & taskParam); 13 | void deleteEntryFromRegistry(const QString & taskParam); 14 | public: 15 | explicit StartupTasksTableWidget(QWidget *parent = nullptr); 16 | ~StartupTasksTableWidget() = default; 17 | void refresh(); 18 | void saveInSettings(); 19 | private slots: 20 | void checkBoxToggled(bool val); 21 | public slots: 22 | void addStartupTaskReceived(); 23 | void removeStartupTaskReceived(); 24 | void editFromDialogReceived(); 25 | }; 26 | 27 | #endif // STARTUPTASKSTABLEWIDGET_H 28 | -------------------------------------------------------------------------------- /ui/editselectedactiondialogs/KeysSequenceSelectedEditDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYSSEQUENCESELECTEDEDITDIALOG_H 2 | #define KEYSSEQUENCESELECTEDEDITDIALOG_H 3 | 4 | #include "actions/ActionParameters.h" 5 | #include 6 | 7 | namespace Ui { 8 | class KeysSequenceSelectedEditDialog; 9 | } 10 | 11 | class KeysSequenceSelectedEditDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit KeysSequenceSelectedEditDialog(QWidget *parent = nullptr); 17 | ~KeysSequenceSelectedEditDialog(); 18 | void setEditable(bool id); 19 | void setIdentity(const QString & id); 20 | QString identity(); 21 | void setTableKeysSequence(const PressedReleaseDelaysKeysMap &tableContent); 22 | PressedReleaseDelaysKeysMap tableKeysSequence(); 23 | public slots: 24 | QList addKeysRow(); 25 | void removeLastKeysRow(); 26 | private slots: 27 | void accept() override; 28 | 29 | private: 30 | Ui::KeysSequenceSelectedEditDialog *ui; 31 | }; 32 | 33 | #endif // KEYSSEQUENCESELECTEDEDITDIALOG_H 34 | -------------------------------------------------------------------------------- /ui/actionwidgets/KeysSequenceWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYSSEQUENCEWIDGET_H 2 | #define KEYSSEQUENCEWIDGET_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | #include "ui/createactiondialogs/CreateKeysSequenceActionDialog.h" 6 | #include "ui/CustomPrimaryWidgets.h" 7 | #include 8 | 9 | class KeysSequenceWidget : public AbstractActionWidget 10 | { 11 | Q_OBJECT 12 | CreateKeysSequenceActionDialog *m_createKeysSeqActionDialog = nullptr; 13 | NoWheelFocusSpinBox *m_loopSpin = nullptr; 14 | void changedRunningState() override; 15 | public: 16 | explicit KeysSequenceWidget(QWidget *parent = nullptr); 17 | ~KeysSequenceWidget() = default; 18 | void buildWidget() override; 19 | public slots: 20 | void keysSeqIdentityReceived(QString id); // not const & because it's a slot, will make copy evenif 21 | private slots: 22 | void timesToRunChanged(int times); 23 | private: 24 | void refreshLoopsRemainingText(const QDateTime& departureDate); 25 | signals: 26 | }; 27 | 28 | #endif // KEYSSEQUENCEWIDGET_H 29 | -------------------------------------------------------------------------------- /actions/RunningOtherTaskAction.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNINGOTHERTASKACTION_H 2 | #define RUNNINGOTHERTASKACTION_H 3 | 4 | #include "AbstractAction.h" 5 | 6 | class RunningOtherTaskAction : public AbstractAction 7 | { 8 | Q_OBJECT 9 | private: 10 | QString m_taskName; 11 | int m_delay; // in seconds 12 | int m_timesToRun = 1; 13 | public: 14 | RunningOtherTaskAction(); 15 | ~RunningOtherTaskAction() = default; 16 | RunningOtherTaskAction(const RunningOtherTaskAction & other) = delete; 17 | RunningOtherTaskAction& operator=(const RunningOtherTaskAction & other) = delete; 18 | 19 | void runAction() override; 20 | void setParameters(const ActionParameters& param) override; 21 | std::shared_ptr deepCopy() const override; 22 | ActionParameters generateParameters() const override; 23 | void optionalProcesses() override {} 24 | 25 | friend class RunningOtherTaskWidget; 26 | signals: 27 | void autoRunTaskRequest(QString filename, int delay, int loopTimes); 28 | }; 29 | 30 | #endif // RUNNINGOTHERTASKACTION_H 31 | -------------------------------------------------------------------------------- /ui/actionwidgets/CursorMovementsWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef CURSORMOVEMENTSWIDGET_H 2 | #define CURSORMOVEMENTSWIDGET_H 3 | 4 | #include "ui/actionwidgets/AbstractActionWidget.h" 5 | #include "ui/createactiondialogs/CreateCursorMovementsActionDialog.h" 6 | #include "ui/CustomPrimaryWidgets.h" 7 | #include 8 | 9 | class CursorMovementsWidget : public AbstractActionWidget 10 | { 11 | Q_OBJECT 12 | CreateCursorMovementsActionDialog *m_createCursorMovsActionDialog = nullptr; 13 | NoWheelFocusSpinBox *m_loopSpin = nullptr; 14 | void changedRunningState() override; 15 | public: 16 | explicit CursorMovementsWidget(QWidget *parent = nullptr); 17 | ~CursorMovementsWidget() = default; 18 | void buildWidget() override; 19 | public slots: 20 | void cursorMovsIdentityReceived(QString id); // not const & because it's a slot, will make copy evenif 21 | private slots: 22 | void timesToRunChanged(int times); 23 | private: 24 | void refreshLoopsRemainingText(const QDateTime& departureDate); 25 | }; 26 | 27 | #endif // CURSORMOVEMENTSWIDGET_H 28 | -------------------------------------------------------------------------------- /ui/various_dialogs/StartupTasksDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "StartupTasksDialog.h" 2 | #include "ui_StartupTasksDialog.h" 3 | #include "ui/tablewidgets/StartupTasksTableWidget.h" 4 | 5 | StartupTasksDialog::StartupTasksDialog(QWidget *parent) 6 | : QDialog(parent) 7 | , ui(new Ui::StartupTasksDialog) 8 | { 9 | ui->setupUi(this); 10 | ui->addButton->setObjectName("plusminusButton"); 11 | ui->removeButton->setObjectName("plusminusButton"); 12 | ui->tableWidget->horizontalHeader()->resizeSection(1,80); 13 | ui->tableWidget->horizontalHeader()->resizeSection(2,90); 14 | ui->tableWidget->horizontalHeader()->resizeSection(3,100); 15 | connect(ui->addButton, &QPushButton::released, ui->tableWidget, &StartupTasksTableWidget::addStartupTaskReceived); 16 | connect(ui->removeButton, &QPushButton::released, ui->tableWidget, &StartupTasksTableWidget::removeStartupTaskReceived); 17 | } 18 | 19 | StartupTasksDialog::~StartupTasksDialog() 20 | { 21 | delete ui; 22 | } 23 | 24 | void StartupTasksDialog::showDialog() 25 | { 26 | ui->tableWidget->refresh(); 27 | show(); 28 | } 29 | -------------------------------------------------------------------------------- /actions/CursorMovementsAction.h: -------------------------------------------------------------------------------- 1 | #ifndef CURSORMOVEMENTSACTION_H 2 | #define CURSORMOVEMENTSACTION_H 3 | 4 | #include "AbstractAction.h" 5 | 6 | class CursorMovementsAction : public AbstractAction 7 | { 8 | Q_OBJECT 9 | private: 10 | CursorMovementsList m_cursorMovementsList; 11 | QString m_movementsId; 12 | int m_timesToRun = 1; 13 | QStringList m_cursorMovementsOptionalKeysStroke; 14 | public: 15 | CursorMovementsAction(); 16 | ~CursorMovementsAction() = default; 17 | CursorMovementsAction(const CursorMovementsAction & other) = delete; 18 | CursorMovementsAction& operator=(const CursorMovementsAction & other) = delete; 19 | 20 | void runAction() override; 21 | void setParameters(const ActionParameters& param) override; 22 | std::shared_ptr deepCopy() const override; 23 | ActionParameters generateParameters() const override; 24 | 25 | void optionalProcesses() override {} 26 | int computeOneExecutionDuration(); // in miliseconds 27 | 28 | friend class CursorMovementsWidget; 29 | }; 30 | 31 | #endif // CURSORMOVEMENTSACTION_H 32 | -------------------------------------------------------------------------------- /ui/various_dialogs/CreateLoadTaskDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATELOADTASKDIALOG_H 2 | #define CREATELOADTASKDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CreateLoadTaskDialog; 8 | } 9 | 10 | class CreateLoadTaskDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CreateLoadTaskDialog(QWidget *parent = nullptr); 16 | ~CreateLoadTaskDialog(); 17 | void showDialog(); 18 | 19 | public: 20 | void renameFilename(const QString &oldFileName, const QString &oldFilePath, bool duplicate = false); 21 | private slots: 22 | void accept() override; 23 | void onOpenFilename(); 24 | void onDeleteFilename(); 25 | void onRenameFilename(); 26 | void onDuplicateFilename(); 27 | signals: 28 | void requestOpenNewTab(QString); 29 | void requestRefreshTabs(); 30 | void taskfilePathChanged(QString,QString); 31 | 32 | private: 33 | Ui::CreateLoadTaskDialog *ui; 34 | void fillExistingTasksTable(); 35 | void createTasksFolderIfNotExist(); 36 | bool doesFilenameContainForbiddenChar(const QString & filename); 37 | }; 38 | 39 | #endif // CREATELOADTASKDIALOG_H 40 | -------------------------------------------------------------------------------- /actions/KeysSequenceAction.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYSSEQUENCEACTION_H 2 | #define KEYSSEQUENCEACTION_H 3 | 4 | #include "AbstractAction.h" 5 | 6 | class KeysSequenceAction : public AbstractAction 7 | { 8 | Q_OBJECT 9 | private: 10 | PressedReleaseDelaysKeysMap m_keysSeqMap; 11 | QString m_sequenceId; 12 | QMap> m_keysStrokeTimeline; // Timeline of keys to stroke, each time contain 2 vectors : [0] press keys list [1] released keys list 13 | int m_timesToRun = 1; 14 | public: 15 | KeysSequenceAction(); 16 | ~KeysSequenceAction() = default; 17 | KeysSequenceAction(const KeysSequenceAction & other) = delete; 18 | KeysSequenceAction& operator=(const KeysSequenceAction & other) = delete; 19 | 20 | void runAction() override; 21 | void setParameters(const ActionParameters& param) override; 22 | std::shared_ptr deepCopy() const override; 23 | ActionParameters generateParameters() const override; 24 | 25 | void generateTimeline(); 26 | void optionalProcesses() override {generateTimeline();} 27 | int computeOneExecutionDuration(); // in miliseconds 28 | 29 | friend class KeysSequenceWidget; 30 | }; 31 | 32 | #endif // KEYSSEQUENCEACTION_H 33 | -------------------------------------------------------------------------------- /ui/getdialogs/getImagePathDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "getImagePathDialog.h" 2 | #include "ui_getImagePathDialog.h" 3 | #include 4 | #include 5 | 6 | getImagePathDialog::getImagePathDialog(QWidget *parent) 7 | : QDialog(parent) 8 | , ui(new Ui::getImagePathDialog) 9 | { 10 | ui->setupUi(this); 11 | ui->pushButton->setObjectName("browseButton"); 12 | connect(ui->pushButton, &QPushButton::released, this, &getImagePathDialog::showBrowseFilesDialog); 13 | 14 | } 15 | 16 | getImagePathDialog::~getImagePathDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void getImagePathDialog::showBrowseFilesDialog() 22 | { 23 | QString dir = QFileDialog::getSaveFileName(this, tr("Define the image file path"),ui->lineEdit->text(),tr("PNG (*.png)")); 24 | 25 | ui->lineEdit->setText(dir); 26 | } 27 | 28 | void getImagePathDialog::accept() 29 | { 30 | emit sendImage(ui->lineEdit->text()); 31 | 32 | QDialog::accept(); 33 | } 34 | 35 | void getImagePathDialog::showDialog() 36 | { 37 | QDialog::show(); 38 | auto buttonSender = qobject_cast(sender()); 39 | if(buttonSender == nullptr) 40 | return; 41 | ui->lineEdit->setText(buttonSender->text()); 42 | } 43 | -------------------------------------------------------------------------------- /actions/AbstractAction.h: -------------------------------------------------------------------------------- 1 | #ifndef ABSTRACTACTION_H 2 | #define ABSTRACTACTION_H 3 | 4 | #include "actions/ActionParameters.h" 5 | #include 6 | 7 | enum class ActionType { 8 | Undefined, 9 | Paste, 10 | Wait, 11 | KeysSequence, 12 | SystemCommand, 13 | CursorMovements, 14 | RunningOtherTask 15 | }; 16 | 17 | class AbstractAction : public QObject 18 | { 19 | Q_OBJECT 20 | static unsigned int s_idCounter; 21 | protected: 22 | unsigned int m_ID = 0; 23 | unsigned int m_refID = 0; 24 | public: 25 | AbstractAction(); 26 | virtual ~AbstractAction() = default; 27 | AbstractAction(const AbstractAction & other) = delete; 28 | AbstractAction& operator=(const AbstractAction & other) = delete; 29 | 30 | virtual void runAction() = 0; 31 | virtual void setParameters(const ActionParameters& param) = 0; 32 | virtual std::shared_ptr deepCopy() const = 0; 33 | virtual ActionParameters generateParameters() const = 0; 34 | virtual void optionalProcesses() = 0; 35 | 36 | ActionType e_type; 37 | unsigned int getID() const {return m_ID;} 38 | unsigned int getRefID() const {return m_refID;} 39 | }; 40 | 41 | #endif // ABSTRACTACTION_H 42 | -------------------------------------------------------------------------------- /ui/getdialogs/getProgramPathDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "getProgramPathDialog.h" 2 | #include "ui_getProgramPathDialog.h" 3 | #include 4 | #include 5 | 6 | getProgramPathDialog::getProgramPathDialog(QWidget *parent) 7 | : QDialog(parent) 8 | , ui(new Ui::getProgramPathDialog) 9 | { 10 | ui->setupUi(this); 11 | ui->pushButton->setObjectName("browseButton"); 12 | connect(ui->pushButton, &QPushButton::released, this, &getProgramPathDialog::showBrowseFilesDialog); 13 | } 14 | 15 | getProgramPathDialog::~getProgramPathDialog() 16 | { 17 | delete ui; 18 | } 19 | 20 | void getProgramPathDialog::showBrowseFilesDialog() 21 | { 22 | QString dir; 23 | dir = QFileDialog::getOpenFileName(this, tr("Select a program"),ui->lineEdit->text()); 24 | 25 | ui->lineEdit->setText(dir); 26 | } 27 | 28 | void getProgramPathDialog::accept() 29 | { 30 | emit sendProgram(ui->lineEdit->text()); 31 | 32 | QDialog::accept(); 33 | } 34 | 35 | void getProgramPathDialog::showDialog() 36 | { 37 | QDialog::show(); 38 | auto buttonSender = qobject_cast(sender()); 39 | if(buttonSender == nullptr) 40 | return; 41 | ui->lineEdit->setText(buttonSender->text()); 42 | } 43 | -------------------------------------------------------------------------------- /ui/getdialogs/getFolderPathDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "getFolderPathDialog.h" 2 | #include "ui_getFolderPathDialog.h" 3 | #include 4 | #include 5 | 6 | getFolderPathDialog::getFolderPathDialog(QWidget *parent) 7 | : QDialog(parent) 8 | , ui(new Ui::getFolderPathDialog) 9 | { 10 | ui->setupUi(this); 11 | ui->pushButton->setObjectName("browseButton"); 12 | connect(ui->pushButton, &QPushButton::released, this, &getFolderPathDialog::showBrowseFoldersDialog); 13 | } 14 | 15 | getFolderPathDialog::~getFolderPathDialog() 16 | { 17 | delete ui; 18 | } 19 | 20 | void getFolderPathDialog::showBrowseFoldersDialog() 21 | { 22 | QString dir = QFileDialog::getExistingDirectory(this, tr("Select a directory"),ui->lineEdit->text(),QFileDialog::ShowDirsOnly); 23 | 24 | ui->lineEdit->setText(dir); 25 | } 26 | 27 | void getFolderPathDialog::accept() 28 | { 29 | emit sendDirectory(ui->lineEdit->text()); 30 | 31 | QDialog::accept(); 32 | } 33 | 34 | void getFolderPathDialog::showDialog() 35 | { 36 | QDialog::show(); 37 | auto buttonSender = qobject_cast(sender()); 38 | if(buttonSender == nullptr) 39 | return; 40 | ui->lineEdit->setText(buttonSender->text()); 41 | } 42 | -------------------------------------------------------------------------------- /ui/getdialogs/getFilePathDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "getFilePathDialog.h" 2 | #include "ui_getFilePathDialog.h" 3 | #include 4 | 5 | getFilePathDialog::getFilePathDialog(QWidget *parent, bool getSaved) 6 | : QDialog(parent), m_getSavedFileName(getSaved) 7 | , ui(new Ui::getFilePathDialog) 8 | { 9 | ui->setupUi(this); 10 | ui->pushButton->setObjectName("browseButton"); 11 | connect(ui->pushButton, &QPushButton::released, this, &getFilePathDialog::showBrowseFilesDialog); 12 | } 13 | 14 | getFilePathDialog::~getFilePathDialog() 15 | { 16 | delete ui; 17 | } 18 | 19 | void getFilePathDialog::showBrowseFilesDialog() 20 | { 21 | QString dir; 22 | if(m_getSavedFileName) 23 | dir = QFileDialog::getSaveFileName(this, tr("Select a file"),ui->lineEdit->text()); 24 | else 25 | dir = QFileDialog::getOpenFileName(this, tr("Select a file"),ui->lineEdit->text()); 26 | 27 | ui->lineEdit->setText(dir); 28 | } 29 | 30 | void getFilePathDialog::accept() 31 | { 32 | emit sendFile(ui->lineEdit->text()); 33 | 34 | QDialog::accept(); 35 | } 36 | 37 | void getFilePathDialog::showDialog() 38 | { 39 | QDialog::show(); 40 | auto buttonSender = qobject_cast(sender()); 41 | if(buttonSender == nullptr) 42 | return; 43 | ui->lineEdit->setText(buttonSender->text()); 44 | } 45 | -------------------------------------------------------------------------------- /actions/RunningOtherTaskAction.cpp: -------------------------------------------------------------------------------- 1 | #include "RunningOtherTaskAction.h" 2 | 3 | #include "mainwindow.h" 4 | 5 | RunningOtherTaskAction::RunningOtherTaskAction() : AbstractAction() 6 | { 7 | e_type = ActionType::RunningOtherTask; 8 | 9 | connect(this, &RunningOtherTaskAction::autoRunTaskRequest, MainWindow::getInstance().get(), &MainWindow::autoRun); 10 | } 11 | 12 | void RunningOtherTaskAction::runAction() 13 | { 14 | if(!m_taskName.isEmpty() && m_delay >= 0 && m_timesToRun > 0) 15 | emit autoRunTaskRequest(m_taskName, m_delay, m_timesToRun); 16 | } 17 | 18 | void RunningOtherTaskAction::setParameters(const ActionParameters ¶m) 19 | { 20 | m_taskName = param.m_taskName; 21 | m_delay = param.m_delay; 22 | m_timesToRun = param.m_timesToRun; 23 | } 24 | 25 | std::shared_ptr RunningOtherTaskAction::deepCopy() const 26 | { 27 | auto actToReturn = std::make_shared(); 28 | actToReturn->m_taskName = m_taskName; 29 | actToReturn->m_delay = m_delay; 30 | actToReturn->m_timesToRun = m_timesToRun; 31 | actToReturn->m_refID = m_ID; 32 | return actToReturn; 33 | } 34 | 35 | ActionParameters RunningOtherTaskAction::generateParameters() const 36 | { 37 | ActionParameters param; 38 | param.m_taskName = m_taskName; 39 | param.m_delay = m_delay; 40 | param.m_timesToRun = m_timesToRun; 41 | return param; 42 | } 43 | -------------------------------------------------------------------------------- /ui/editselectedactiondialogs/CursorMovementsSelectedEditDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CURSORMOVEMENTSSELECTEDEDITDIALOG_H 2 | #define CURSORMOVEMENTSSELECTEDEDITDIALOG_H 3 | 4 | #include "actions/ActionParameters.h" 5 | #include 6 | #include "ui/getdialogs/getCursorCoordinatesWidget.h" 7 | #include "ui/various_dialogs/KeysSelectorDialog.h" 8 | 9 | namespace Ui { 10 | class CursorMovementsSelectedEditDialog; 11 | } 12 | 13 | class CursorMovementsSelectedEditDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | getCursorCoordinatesWidget *m_getCursorCoordinatesWidget = nullptr; 17 | KeysSelectorDialog *m_keySelectorDialog = nullptr; 18 | public: 19 | explicit CursorMovementsSelectedEditDialog(QWidget *parent = nullptr); 20 | ~CursorMovementsSelectedEditDialog(); 21 | void setEditable(bool id); 22 | void setIdentity(const QString & id); 23 | QString identity(); 24 | void setTableCursorMovements(const CursorMovementsList &tableContent); 25 | CursorMovementsList tableCursorMovements(); 26 | void setOptionalKeysStroke(const QStringList &keysStroke); 27 | QStringList optionalKeysStroke(); 28 | public slots: 29 | QList addMovsRow(); 30 | void removeLastMovsRow(); 31 | void coordinatesReceived(int index, int x, int y); 32 | private slots: 33 | void accept() override; 34 | private: 35 | Ui::CursorMovementsSelectedEditDialog *ui; 36 | }; 37 | 38 | #endif // CURSORMOVEMENTSSELECTEDEDITDIALOG_H 39 | -------------------------------------------------------------------------------- /actions/PasteAction.cpp: -------------------------------------------------------------------------------- 1 | #include "PasteAction.h" 2 | #include "ActionsTools.h" 3 | 4 | #include 5 | 6 | PasteAction::PasteAction() : AbstractAction() 7 | { 8 | e_type = ActionType::Paste; 9 | } 10 | 11 | void PasteAction::runAction() 12 | { 13 | int timesToRun = m_timesToRun; 14 | 15 | begin: 16 | 17 | ActionsTools::setClipboard(m_content); 18 | ActionsTools::pasteKeystrokeSimulate(); 19 | 20 | --timesToRun; 21 | if(timesToRun > 0) 22 | goto begin; 23 | } 24 | 25 | void PasteAction::setParameters(const ActionParameters ¶m) 26 | { 27 | m_content = param.m_pasteContent; 28 | m_contentId = param.m_dataId; 29 | m_timesToRun = param.m_timesToRun; 30 | } 31 | 32 | std::shared_ptr PasteAction::deepCopy() const 33 | { 34 | auto actToReturn = std::make_shared(); 35 | actToReturn->m_content = m_content; 36 | actToReturn->m_contentId = m_contentId; 37 | actToReturn->m_timesToRun = m_timesToRun; 38 | actToReturn->m_refID = m_ID; 39 | return actToReturn; 40 | } 41 | 42 | ActionParameters PasteAction::generateParameters() const 43 | { 44 | ActionParameters param; 45 | param.m_pasteContent = m_content; 46 | param.m_dataId = m_contentId; 47 | param.m_timesToRun = m_timesToRun; 48 | return param; 49 | } 50 | 51 | int PasteAction::computeOneExecutionDuration() 52 | { 53 | return 200;// 0.2 second as the minimal time wait for each execution 54 | } 55 | -------------------------------------------------------------------------------- /private_policy.txt: -------------------------------------------------------------------------------- 1 | ___Privacy Policy___ 2 | Last updated: March 18, 2024 3 | 4 | This Privacy Policy describes Our policies and procedures on the collection, use and disclosure of your information 5 | 6 | By using the application "Tasket++" you are consenting to our policies regarding the collection, use and disclosure of personal information set out in this privacy policy. 7 | 8 | __Definition__ 9 | 10 | - Application : refers to Tasket++, the software program provided by the Us. 11 | - You : means the individual accessing or using the Application, or the company, or other legal entity on behalf of which such individual is accessing or using the Application, as applicable. 12 | - Us : means the conceptor and developer of the software, in the person of Amir Hammoutene 13 | 14 | __Collection of Personal Information__ 15 | 16 | We do not collect, store, use or share any information, personal or otherwise. 17 | 18 | __Email__ 19 | 20 | If you email the developer for support or other feedback, the emails with email addresses will be retained for quality assurance purposes. The email addresses will be used only to reply to the concerns or suggestions raised and will never be used for any marketing purpose. 21 | 22 | __Disclosure of Personal Information__ 23 | 24 | We will not disclose your information to any third party except if you expressly consent or where required by law. 25 | 26 | __Contact Us__ 27 | 28 | If you have any questions regarding this privacy policy, you can email : contact@amirhammoutene.dev -------------------------------------------------------------------------------- /ui/getdialogs/getCursorCoordinatesWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "getCursorCoordinatesWidget.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "actions/ActionsTools.h" 7 | 8 | getCursorCoordinatesWidget::getCursorCoordinatesWidget(QWidget *parent) 9 | : QDialog(parent) 10 | { 11 | QPixmap cursorPix(":/img/crosshair.png"); 12 | cursorPix = cursorPix.scaled(32,32); 13 | setCursor(QCursor(cursorPix)); 14 | setWindowOpacity(0.4); 15 | setModal(true); 16 | setWindowFlags(windowFlags() | Qt::FramelessWindowHint); 17 | } 18 | 19 | getCursorCoordinatesWidget::~getCursorCoordinatesWidget() 20 | { 21 | } 22 | 23 | void getCursorCoordinatesWidget::showWidget() 24 | { 25 | auto buttonSender = qobject_cast(sender()); 26 | if(buttonSender == nullptr) 27 | return; 28 | 29 | m_refIndex = buttonSender->property("index").toInt(); 30 | 31 | QDialog::show(); 32 | int width = 0; 33 | int height = 0; 34 | for(auto &screen : QApplication::screens()) 35 | { 36 | width+=screen->geometry().width(); 37 | if(height < screen->geometry().height()) 38 | height = screen->geometry().height(); 39 | } 40 | setGeometry(0,0,width,height); 41 | } 42 | 43 | void getCursorCoordinatesWidget::mouseReleaseEvent(QMouseEvent *ev) 44 | { 45 | auto coordsPair = ActionsTools::getCursorPos(); 46 | emit sendCoordinates(m_refIndex,coordsPair.first,coordsPair.second); 47 | QDialog::close(); 48 | } 49 | -------------------------------------------------------------------------------- /TaskThread.cpp: -------------------------------------------------------------------------------- 1 | #include "TaskThread.h" 2 | 3 | TaskThread::TaskThread(QObject *parent) 4 | : QThread{parent} 5 | { 6 | 7 | } 8 | 9 | TaskThread::~TaskThread() 10 | { 11 | quit(); 12 | requestInterruption(); 13 | wait(); 14 | } 15 | 16 | void TaskThread::copyActionsList(const std::shared_ptr &task) 17 | { 18 | m_actionsList.clear(); 19 | 20 | if(task == nullptr) 21 | return; 22 | 23 | for(auto it = task->m_actionsOrderedList.begin(); it != task->m_actionsOrderedList.end(); ++it) 24 | { 25 | if((*it) == nullptr) 26 | continue; 27 | m_actionsList.append((*it)->deepCopy()); 28 | } 29 | } 30 | 31 | void TaskThread::stop() 32 | { 33 | m_haveToStop = true; 34 | terminate(); 35 | } 36 | 37 | void TaskThread::run() 38 | { 39 | begin: 40 | 41 | for(auto it = m_actionsList.begin(); it != m_actionsList.end(); ++it) 42 | { 43 | if(m_haveToStop) 44 | return; 45 | if((*it) == nullptr) 46 | continue; 47 | emit sendRunningStateAct((*it)->getRefID()); 48 | 49 | (*it)->runAction(); 50 | 51 | if(m_haveToStop) 52 | return; 53 | if((*it) == nullptr) 54 | continue; 55 | emit sendDoneStateAct((*it)->getRefID()); 56 | } 57 | 58 | --m_timesToRun; 59 | if(m_loop || m_timesToRun > 0) 60 | { 61 | emit sendFinishedOneLoop(); 62 | goto begin; 63 | } 64 | 65 | emit sendFinishedOneLoop(); 66 | emit sendFinishedAllLoops(); 67 | } 68 | -------------------------------------------------------------------------------- /ui/various_dialogs/KeysSelectorDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "KeysSelectorDialog.h" 2 | #include "ui_KeysSelectorDialog.h" 3 | 4 | KeysSelectorDialog::KeysSelectorDialog(QWidget *parent) 5 | : QDialog(parent) 6 | , ui(new Ui::KeysSelectorDialog) 7 | { 8 | ui->setupUi(this); 9 | connect(ui->treeWidget, &QTreeWidget::itemDoubleClicked, this, &KeysSelectorDialog::appendToList); 10 | connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &KeysSelectorDialog::removeFromList); 11 | } 12 | 13 | KeysSelectorDialog::~KeysSelectorDialog() 14 | { 15 | delete ui; 16 | } 17 | 18 | void KeysSelectorDialog::appendToList(QTreeWidgetItem *item, int) 19 | { 20 | if(item==nullptr || item->parent() == nullptr) 21 | return; 22 | ui->listWidget->addItem(item->text(0)); 23 | } 24 | 25 | void KeysSelectorDialog::removeFromList(QListWidgetItem *item) 26 | { 27 | if(item == nullptr) 28 | return; 29 | delete ui->listWidget->takeItem(ui->listWidget->row(item)); 30 | } 31 | 32 | void KeysSelectorDialog::accept() 33 | { 34 | QStringList sentList; 35 | for(int k = 0; k < ui->listWidget->count(); ++k) 36 | { 37 | sentList.append(ui->listWidget->item(k)->text()); 38 | } 39 | 40 | emit sendKeysList(sentList); 41 | QDialog::accept(); 42 | } 43 | 44 | void KeysSelectorDialog::showDialog() 45 | { 46 | QObject* sender = QObject::sender(); 47 | if(sender == nullptr) 48 | return; 49 | 50 | ui->listWidget->clear(); 51 | ui->listWidget->addItems(sender->property("keys").toStringList()); 52 | show(); 53 | } 54 | -------------------------------------------------------------------------------- /actions/ActionsTools.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTIONSTOOLS_H 2 | #define ACTIONSTOOLS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "actions/ActionParameters.h" 10 | #include "shobjidl.h" 11 | #include "shlguid.h" 12 | 13 | class ActionsTools 14 | { 15 | static const int s_cursorFrequency = 20; 16 | public: 17 | ActionsTools(); 18 | ~ActionsTools() = default; 19 | 20 | static void pasteKeystrokeSimulate(); 21 | static void keyStokeSimulate(const QString & keyAsStr, DWORD typeOfPress); 22 | static void mouseStokeSimulate(const QString & keyAsStr, DWORD typeOfPress); 23 | static DWORD mouseFlagPressReleaseConversion(WORD keyInputWord, DWORD typeOfPress); 24 | static void setClipboard(const QString & str); 25 | static PressedReleaseDelaysKeysMap fromStandardQMapToKeysSeqMap(const QMap &standardMap); 26 | static QString fromKeysSeqMapToPrintedString(const PressedReleaseDelaysKeysMap &map); 27 | static QMap m_keysStrToInputWordMap; 28 | static QString fromCursorMovsMapToPrintedString(const CursorMovementsList &map); 29 | static CursorMovementsList fromStandardQMapToCursorMovsMap(const QList &standardList); 30 | static void moveCursorSimulate(int xPos, int yPos, int time); 31 | static QPair getCursorPos(); 32 | static void createDesktopShortcut(const QString & savePath, const QString & linkPath, const QString &args, const QString &linkname); 33 | }; 34 | 35 | #endif // ACTIONSTOOLS_H 36 | -------------------------------------------------------------------------------- /TaskTabsManager.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKTABSMANAGER_H 2 | #define TASKTABSMANAGER_H 3 | 4 | #include "ui/TaskTab.h" 5 | 6 | #include 7 | #include 8 | 9 | class MainWindow; 10 | 11 | class TaskTabsManager : public QObject 12 | { 13 | Q_OBJECT 14 | 15 | QMap m_taskTabsMap; 16 | unsigned int m_idCounter = 0; 17 | QMap m_taskFilePathsMap; // may contains old closed tab paths of file, but should be updated with opened tasks 18 | public: 19 | explicit TaskTabsManager(); 20 | ~TaskTabsManager(); 21 | void forceCloseTask(int id); 22 | void scheduleTaskFromId(int id, qint64 delay, int loopTimes = 1); 23 | public slots: 24 | int onOpenNewTabRequest(const QString & path); 25 | void onTabCloseRequest(int index); 26 | void onRefreshTabsRequest(); 27 | void onTaskfilePathChanged(QString oldpath, QString newpath); 28 | void forceStopAllRunningTasksReceived(); 29 | void saveTaskReceived(int taskTabId, bool verbose = false); 30 | QJsonObject actionToJson(const std::shared_ptr &act); 31 | std::shared_ptr jsonToAction(const QJsonObject &jobj); 32 | void saveAllTasks(); 33 | bool isAnyTaskModified(); 34 | protected: 35 | TaskTab* createEmptyTaskAndOpenTab(const QString& name); 36 | int appendTaskInMap(TaskTab* task); 37 | int getIdfromTaskName(const QString &name) const; 38 | int getTabIndexfomId(int id) const; 39 | void createAndLoadTaskObject(int id); 40 | 41 | friend class MainWindow; 42 | }; 43 | 44 | #endif // TASKTABSMANAGER_H 45 | -------------------------------------------------------------------------------- /ui/editselectedactiondialogs/SentenceSelectedEditDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "SentenceSelectedEditDialog.h" 2 | #include "ui_SentenceSelectedEditDialog.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | SentenceSelectedEditDialog::SentenceSelectedEditDialog(QWidget *parent) 9 | : QDialog(parent) 10 | , ui(new Ui::SentenceSelectedEditDialog) 11 | { 12 | ui->setupUi(this); 13 | ui->lineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("\\w+"), this)); 14 | } 15 | 16 | SentenceSelectedEditDialog::~SentenceSelectedEditDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void SentenceSelectedEditDialog::setEditable(bool id) 22 | { 23 | ui->lineEdit->setReadOnly(!id); 24 | } 25 | 26 | void SentenceSelectedEditDialog::setIdentity(const QString &id) 27 | { 28 | ui->lineEdit->setText(id); 29 | } 30 | 31 | QString SentenceSelectedEditDialog::identity() 32 | { 33 | return ui->lineEdit->text(); 34 | } 35 | 36 | void SentenceSelectedEditDialog::setContent(const QString &content) 37 | { 38 | ui->plainTextEdit->setPlainText(content); 39 | } 40 | 41 | QString SentenceSelectedEditDialog::content() 42 | { 43 | return ui->plainTextEdit->toPlainText(); 44 | } 45 | 46 | void SentenceSelectedEditDialog::accept() 47 | { 48 | if(ui->lineEdit->text().isEmpty()) 49 | { 50 | QMessageBox::warning(this, tr("Sentence has no identity"), 51 | tr("The sentence you tried to add has no identity, please define one.")); 52 | return; 53 | } 54 | QDialog::accept(); 55 | } 56 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateSystemCommandActionDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATESYSTEMCOMMANDACTIONDIALOG_H 2 | #define CREATESYSTEMCOMMANDACTIONDIALOG_H 3 | 4 | #include 5 | #include 6 | #include "ui/getdialogs/getProgramPathDialog.h" 7 | #include "ui/getdialogs/getFilePathDialog.h" 8 | #include "ui/getdialogs/getFolderPathDialog.h" 9 | #include "ui/getdialogs/getImagePathDialog.h" 10 | #include "ui/getdialogs/getAutoRenameOptionDialog.h" 11 | 12 | namespace Ui { 13 | class CreateSystemCommandActionDialog; 14 | } 15 | 16 | class CreateSystemCommandActionDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | QString m_type; 21 | QPushButton *m_option1Button = nullptr; 22 | QPushButton *m_option2Button = nullptr; 23 | getProgramPathDialog *m_programPathDialog = nullptr; 24 | getFilePathDialog *m_filePathDialog = nullptr; 25 | getFolderPathDialog *m_folderPathDialog = nullptr; 26 | getFilePathDialog *m_savedFilePathDialog = nullptr; 27 | getImagePathDialog *m_imagePathDialog = nullptr; 28 | getAutoRenameOptionDialog *m_autorenameDialog = nullptr; 29 | void activateButtons(); 30 | public: 31 | explicit CreateSystemCommandActionDialog(QWidget *parent = nullptr); 32 | ~CreateSystemCommandActionDialog(); 33 | private slots: 34 | void accept() override; 35 | void commandButtonPushed(); 36 | public slots: 37 | void showDialog(); 38 | signals: 39 | void sendSystemCommand(QString sysCmdType, QString param1, QString param2); 40 | private: 41 | Ui::CreateSystemCommandActionDialog *ui; 42 | }; 43 | 44 | #endif // CREATESYSTEMCOMMANDACTIONDIALOG_H 45 | -------------------------------------------------------------------------------- /actions/SystemCommandsAction.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSTEMCOMMANDSACTION_H 2 | #define SYSTEMCOMMANDSACTION_H 3 | 4 | #include "AbstractAction.h" 5 | 6 | enum class SystemCommandType { 7 | Undefined, 8 | ShutDown, 9 | Restart, 10 | LogOff, 11 | ChangeAudioVolume, 12 | ChangeDefaultAudioDevice, 13 | KillProcess, 14 | QuitSelfProgram, 15 | CreateFolder, 16 | DeleteFolder, 17 | CreateOneFile, 18 | DeleteOneFile, 19 | TakeScreenshot, 20 | PrintActualScreen, 21 | OpenFile, 22 | CopyOneFile, 23 | ExecuteProgram, 24 | OpenUrl, 25 | OpenFolder 26 | }; 27 | 28 | class SystemCommandAction : public AbstractAction 29 | { 30 | Q_OBJECT 31 | private: 32 | SystemCommandType e_sysCommandType; 33 | QString m_param1; 34 | QString m_param2; 35 | public: 36 | SystemCommandAction(); 37 | ~SystemCommandAction() = default; 38 | SystemCommandAction(const SystemCommandAction & other) = delete; 39 | SystemCommandAction& operator=(const SystemCommandAction & other) = delete; 40 | 41 | void runAction() override; 42 | void setParameters(const ActionParameters& param) override; 43 | std::shared_ptr deepCopy() const override; 44 | ActionParameters generateParameters() const override; 45 | void optionalProcesses() override {} 46 | 47 | QString incrementFilenameIfExists(const QString & path) const; 48 | QString incrementFilenameIfExists(const QString & path, unsigned char ndigits) const; 49 | 50 | friend class SystemCommandWidget; 51 | signals: 52 | void forceQuitProgramRequest(); 53 | }; 54 | 55 | #endif // SYSTEMCOMMANDSACTION_H 56 | -------------------------------------------------------------------------------- /actions/ActionParameters.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTIONPARAMETERS_H 2 | #define ACTIONPARAMETERS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | typedef QPair ReleaseDelayKeysPair;// release delay in milisecond, list of keys as strings 11 | typedef QMap PressedReleaseDelaysKeysMap;// pressed time in milisecond, pair of release delay, list of keys 12 | Q_DECLARE_METATYPE(ReleaseDelayKeysPair); 13 | Q_DECLARE_METATYPE(PressedReleaseDelaysKeysMap); 14 | typedef QList MovementList;// delays (from previous move) in milisecond, moving time in milisecond, screen x,y (4 elements) 15 | typedef QList CursorMovementsList;// delays in milisecond and its movement (time and x,y) 16 | Q_DECLARE_METATYPE(MovementList); 17 | Q_DECLARE_METATYPE(CursorMovementsList); 18 | 19 | class ActionParameters 20 | { 21 | public: 22 | ActionParameters() = default; 23 | ~ActionParameters() = default; 24 | ActionParameters(const ActionParameters &) = default; 25 | ActionParameters &operator=(const ActionParameters &) = default; 26 | 27 | QString m_dataId; 28 | QString m_pasteContent; 29 | long double m_waitDuration; // in seconds 30 | // map with key = delay of key simulated pressed in milisecond, value = pair of release delay (ms) and list of keys label 31 | PressedReleaseDelaysKeysMap m_keysSeqMap; 32 | int m_timesToRun = 1; 33 | QString m_sysCmdTypeStr; 34 | QString m_sysCmdParam1; 35 | QString m_sysCmdParam2; 36 | CursorMovementsList m_cursorMovementsList; 37 | QStringList m_cursorMovementsOptionalKeysStroke; 38 | QString m_taskName; 39 | int m_delay; // in seconds 40 | }; 41 | 42 | Q_DECLARE_METATYPE(ActionParameters); 43 | 44 | #endif // ACTIONPARAMETERS_H 45 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | # Tasket++ 2 | 3 | version 1.6 (December 2025) 4 | 5 | Schedule automated simulations of actions you would perform on your PC. 6 | 7 | 8 | Under GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 9 | Please read license.txt file 10 | 11 | We don't collect any data 12 | Please read private_policy.txt 13 | 14 | ---------- 15 | Details of version 1.6 : 16 | 17 | Stable version, fully functional 18 | 19 | Those actions simulations are available : 20 | 21 | - Keys sequence 22 | - Move Cursor 23 | - Paste text 24 | - Run Windows system specific command (open files, folders, executables, url, shut down pc, reboot, kill processes, create files...) 25 | - Wait 26 | - Run another task 27 | 28 | And other features like data management, scheduled tasks at system startup, create desktop shortcut to autorun a task... 29 | 30 | The goal in future versions is to include those features : 31 | 32 | - Play sound and show alert dialog actions 33 | - Add more Windows system specific command 34 | - Configure global hot keys to schedule a task to run while the user is on another application or video game 35 | 36 | Feedbacks and ideas for further actions are very welcome ! 37 | 38 | ---------- 39 | Available for install on Microsoft Store : 40 | https://apps.microsoft.com/store/detail/XP9CJLHWVXS49P 41 | 42 | Available as a portable version : 43 | https://files.amirhammoutene.dev/Tasket++/1.6/Tasket++_v1.6.zip 44 | 45 | Needs 30 Mo disk space, available for Windows systems only 46 | 47 | ---------- 48 | Has been developed in C++ language, using Qt (6.9.3) framework 49 | 50 | Open Source 51 | 52 | GitHub link for sources : https://github.com/AmirHammouteneEI/ScheduledPasteAndKeys 53 | 54 | ---------- 55 | Conceived and developed by Amir Hammoutene (contact@amirhammoutene.dev). 56 | 57 | Initial work in February 2024. -------------------------------------------------------------------------------- /ui/actionwidgets/AbstractActionWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef ABSTRACTACTIONWIDGET_H 2 | #define ABSTRACTACTIONWIDGET_H 3 | 4 | #include "actions/AbstractAction.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | enum class RunningState{ 11 | NotExecuted, 12 | Running, 13 | Done 14 | }; 15 | 16 | class AbstractActionWidget : public QFrame 17 | { 18 | Q_OBJECT 19 | protected: 20 | QFrame *m_centralWidget = nullptr; 21 | std::shared_ptr m_action = nullptr; 22 | unsigned int m_actionID = 0; 23 | RunningState m_runningState; 24 | virtual void changedRunningState() {} 25 | QPushButton *m_mainButton = nullptr; 26 | QLabel *m_infoLabel = nullptr; 27 | QPushButton *m_removeButton = nullptr; 28 | QPushButton *m_moveToTopButton = nullptr; 29 | QPushButton *m_moveToBottomButton = nullptr; 30 | QPushButton *m_moveUpButton = nullptr; 31 | QPushButton *m_moveDownButton = nullptr; 32 | public: 33 | explicit AbstractActionWidget(QWidget *parent = nullptr); 34 | virtual ~AbstractActionWidget(); 35 | void setRunningState(RunningState state); 36 | void setAction(const std::shared_ptr &action); 37 | virtual void buildWidget() = 0; 38 | unsigned int getActionID() const {return m_actionID;} 39 | 40 | inline bool operator==(const AbstractActionWidget& otherActWidg) { return m_actionID == otherActWidg.m_actionID; } 41 | 42 | protected slots: 43 | void removeSelf(); 44 | void moveToTopSelf(); 45 | void moveToBottomSelf(); 46 | void moveUpSelf(); 47 | void moveDownSelf(); 48 | signals: 49 | void removeActionRequest(unsigned int id); 50 | void moveToTopActionRequest(unsigned int id); 51 | void moveToBottomActionRequest(unsigned int id); 52 | void moveUpActionRequest(unsigned int id); 53 | void moveDownActionRequest(unsigned int id); 54 | void anyParamChanged(); 55 | }; 56 | 57 | #endif // ABSTRACTACTIONWIDGET_H 58 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreatePasteActionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "CreatePasteActionDialog.h" 2 | #include "ui_CreatePasteActionDialog.h" 3 | #include "globals.h" 4 | 5 | #include 6 | 7 | CreatePasteActionDialog::CreatePasteActionDialog(QWidget *parent) 8 | : QDialog(parent) 9 | , ui(new Ui::CreatePasteActionDialog) 10 | { 11 | ui->setupUi(this); 12 | ui->addSentenceButton->setObjectName("plusminusButton"); 13 | connect(ui->addSentenceButton, &QPushButton::released, ui->tableWidget, &SentencesTableWidget::createSentenceReceived); 14 | } 15 | 16 | CreatePasteActionDialog::~CreatePasteActionDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void CreatePasteActionDialog::showDialog() 22 | { 23 | ui->tableWidget->refresh(); 24 | show(); 25 | 26 | // if shows from an existing Paste Widget 27 | auto mainButtonSender = qobject_cast(sender()); 28 | if(mainButtonSender == nullptr) 29 | return; 30 | 31 | if(!mainButtonSender->property("contentId").isValid() || mainButtonSender->property("contentId").toString() == tr("ERROR")) 32 | return; 33 | 34 | ui->tableWidget->selectSentenceFromIdentity(mainButtonSender->property("contentId").toString()); 35 | } 36 | 37 | void CreatePasteActionDialog::accept() 38 | { 39 | QItemSelectionModel *selection = ui->tableWidget->selectionModel(); 40 | if(!selection->hasSelection()) 41 | { 42 | QMessageBox::warning(this, tr("No sentence selected"),G_Sentences::NoSetenceSelected()); 43 | return; 44 | } 45 | 46 | int row = selection->selectedRows().at(0).row(); 47 | QTableWidgetItem *idItem = ui->tableWidget->item(row,0); 48 | if(idItem == nullptr) 49 | { 50 | QMessageBox::warning(nullptr, tr("Internal Error"), 51 | tr("An internal error occured : err04\nitem selected in CreatePasteActionDialog is null !")); 52 | 53 | return; 54 | } 55 | 56 | QString trueId = idItem->text().remove(0,1); 57 | 58 | emit sendSentence(trueId); 59 | 60 | QDialog::accept(); 61 | } 62 | -------------------------------------------------------------------------------- /ui/various_dialogs/DataEditDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "DataEditDialog.h" 2 | #include "ui_DataEditDialog.h" 3 | 4 | DataEditDialog::DataEditDialog(QWidget *parent) 5 | : QDialog(parent) 6 | , ui(new Ui::DataEditDialog) 7 | { 8 | ui->setupUi(this); 9 | 10 | ui->tabWidget->tabBar()->setObjectName("dataTabBar"); 11 | ui->sentencesTableWidget->m_belongsToDataEditDialog = true; 12 | ui->keysSequencesTableWidget->m_belongsToDataEditDialog = true; 13 | ui->cursorMovementsTableWidget->m_belongsToDataEditDialog = true; 14 | 15 | ui->addSentenceButton->setObjectName("plusminusButton"); 16 | ui->removeSentenceButton->setObjectName("plusminusButton"); 17 | ui->addKeysSequenceButton->setObjectName("plusminusButton"); 18 | ui->removeKeysSequenceButton->setObjectName("plusminusButton"); 19 | ui->addCursorMovementsButton->setObjectName("plusminusButton"); 20 | ui->removeCursorMovementsButton->setObjectName("plusminusButton"); 21 | 22 | connect(ui->addSentenceButton, &QPushButton::released, ui->sentencesTableWidget, &SentencesTableWidget::createSentenceReceived); 23 | connect(ui->removeSentenceButton, &QPushButton::released, ui->sentencesTableWidget, &SentencesTableWidget::removeSentenceReceived); 24 | connect(ui->addKeysSequenceButton, &QPushButton::released, ui->keysSequencesTableWidget, &KeysSequencesTableWidget::createKeysSequenceReceived); 25 | connect(ui->removeKeysSequenceButton, &QPushButton::released, ui->keysSequencesTableWidget, &KeysSequencesTableWidget::removeKeysSequenceReceived); 26 | connect(ui->addCursorMovementsButton, &QPushButton::released, ui->cursorMovementsTableWidget, &CursorMovementsTableWidget::createCursorMovementsReceived); 27 | connect(ui->removeCursorMovementsButton, &QPushButton::released, ui->cursorMovementsTableWidget, &CursorMovementsTableWidget::removeCursorMovementsReceived); 28 | } 29 | 30 | DataEditDialog::~DataEditDialog() 31 | { 32 | delete ui; 33 | } 34 | 35 | void DataEditDialog::showDialog() 36 | { 37 | ui->sentencesTableWidget->refresh(); 38 | ui->keysSequencesTableWidget->refresh(); 39 | ui->cursorMovementsTableWidget->refresh(); 40 | show(); 41 | } 42 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateKeysSequenceActionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "CreateKeysSequenceActionDialog.h" 2 | #include "ui_CreateKeysSequenceActionDialog.h" 3 | #include "globals.h" 4 | 5 | #include 6 | 7 | CreateKeysSequenceActionDialog::CreateKeysSequenceActionDialog(QWidget *parent) 8 | : QDialog(parent) 9 | , ui(new Ui::CreateKeysSequenceActionDialog) 10 | { 11 | ui->setupUi(this); 12 | ui->addKeysSequenceButton->setObjectName("plusminusButton"); 13 | connect(ui->addKeysSequenceButton, &QPushButton::released, ui->tableWidget, &KeysSequencesTableWidget::createKeysSequenceReceived); 14 | } 15 | 16 | CreateKeysSequenceActionDialog::~CreateKeysSequenceActionDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void CreateKeysSequenceActionDialog::showDialog() 22 | { 23 | ui->tableWidget->refresh(); 24 | show(); 25 | 26 | // if shows from an existing Keys Sequence Widget 27 | auto mainButtonSender = qobject_cast(sender()); 28 | if(mainButtonSender == nullptr) 29 | return; 30 | 31 | if(!mainButtonSender->property("keysSeqId").isValid() || mainButtonSender->property("keysSeqId").toString() == tr("ERROR")) 32 | return; 33 | 34 | ui->tableWidget->selectKeysSequenceFromIdentity(mainButtonSender->property("keysSeqId").toString()); 35 | } 36 | 37 | void CreateKeysSequenceActionDialog::accept() 38 | { 39 | QItemSelectionModel *selection = ui->tableWidget->selectionModel(); 40 | if(!selection->hasSelection()) 41 | { 42 | QMessageBox::warning(this, tr("No keys sequence selected"),G_Sentences::NoKeysSequenceSelected()); 43 | return; 44 | } 45 | 46 | int row = selection->selectedRows().at(0).row(); 47 | QTableWidgetItem *idItem = ui->tableWidget->item(row,0); 48 | if(idItem == nullptr) 49 | { 50 | QMessageBox::warning(nullptr, tr("Internal Error"), 51 | tr("An internal error occured : err03\nitem selected in CreateKeysSequenceActionDialog is null !")); 52 | 53 | return; 54 | } 55 | 56 | QString trueId = idItem->text().remove(0,1); 57 | 58 | emit sendKeysSequence(trueId); 59 | 60 | QDialog::accept(); 61 | } 62 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateCursorMovementsActionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "CreateCursorMovementsActionDialog.h" 2 | #include "ui_CreateCursorMovementsActionDialog.h" 3 | #include "globals.h" 4 | 5 | #include 6 | 7 | CreateCursorMovementsActionDialog::CreateCursorMovementsActionDialog(QWidget *parent) 8 | : QDialog(parent) 9 | , ui(new Ui::CreateCursorMovementsActionDialog) 10 | { 11 | ui->setupUi(this); 12 | ui->addCursorMovementsButton->setObjectName("plusminusButton"); 13 | connect(ui->addCursorMovementsButton, &QPushButton::released, ui->tableWidget, &CursorMovementsTableWidget::createCursorMovementsReceived); 14 | } 15 | 16 | CreateCursorMovementsActionDialog::~CreateCursorMovementsActionDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void CreateCursorMovementsActionDialog::showDialog() 22 | { 23 | ui->tableWidget->refresh(); 24 | show(); 25 | 26 | // if shows from an existing Keys Sequence Widget 27 | auto mainButtonSender = qobject_cast(sender()); 28 | if(mainButtonSender == nullptr) 29 | return; 30 | 31 | if(!mainButtonSender->property("cursorMovsId").isValid() || mainButtonSender->property("cursorMovsId").toString() == tr("ERROR")) 32 | return; 33 | 34 | ui->tableWidget->selectCursorMovementsFromIdentity(mainButtonSender->property("cursorMovsId").toString()); 35 | } 36 | 37 | void CreateCursorMovementsActionDialog::accept() 38 | { 39 | QItemSelectionModel *selection = ui->tableWidget->selectionModel(); 40 | if(!selection->hasSelection()) 41 | { 42 | QMessageBox::warning(this, tr("No cursor movements set selected"),G_Sentences::NoCursorMovementsSelected()); 43 | return; 44 | } 45 | 46 | int row = selection->selectedRows().at(0).row(); 47 | QTableWidgetItem *idItem = ui->tableWidget->item(row,0); 48 | if(idItem == nullptr) 49 | { 50 | QMessageBox::warning(nullptr, tr("Internal Error"), 51 | tr("An internal error occured : err06\nitem selected in CreateCursorMovementsActionDialog is null !")); 52 | 53 | return; 54 | } 55 | 56 | QString trueId = idItem->text().remove(0,1); 57 | 58 | emit sendCursorMovements(trueId); 59 | 60 | QDialog::accept(); 61 | } 62 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateWaitActionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "CreateWaitActionDialog.h" 2 | #include "ui_CreateWaitActionDialog.h" 3 | #include 4 | 5 | CreateWaitActionDialog::CreateWaitActionDialog(QWidget *parent) 6 | : QDialog(parent) 7 | , ui(new Ui::CreateWaitActionDialog) 8 | { 9 | ui->setupUi(this); 10 | ui->doubleSpinBox->setLocale(QLocale::English); 11 | 12 | connect(ui->bySecondsGroup, &QGroupBox::clicked, this, &CreateWaitActionDialog::uncheckByDayBasedGroup); 13 | connect(ui->byDayGroup, &QGroupBox::clicked, this, &CreateWaitActionDialog::uncheckBySecondsGroup); 14 | } 15 | 16 | CreateWaitActionDialog::~CreateWaitActionDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void CreateWaitActionDialog::uncheckBySecondsGroup() 22 | { 23 | ui->bySecondsGroup->setChecked(false); 24 | ui->byDayGroup->setChecked(true); 25 | } 26 | 27 | void CreateWaitActionDialog::uncheckByDayBasedGroup() 28 | { 29 | ui->byDayGroup->setChecked(false); 30 | ui->bySecondsGroup->setChecked(true); 31 | } 32 | 33 | void CreateWaitActionDialog::accept() 34 | { 35 | if(ui->bySecondsGroup->isChecked()) 36 | emit sendDuration(ui->doubleSpinBox->value()); 37 | else 38 | { 39 | long double totalDuration = QTime(0,0,0).secsTo(ui->timeEdit->time()); 40 | totalDuration += ui->spinBox->value() * 86400; 41 | emit sendDuration(totalDuration); 42 | } 43 | 44 | QDialog::accept(); 45 | } 46 | 47 | void CreateWaitActionDialog::showDialog() 48 | { 49 | show(); 50 | 51 | // if shows from an existing Wait Widget 52 | auto mainButtonSender = qobject_cast(sender()); 53 | if(mainButtonSender == nullptr) 54 | return; 55 | 56 | if(!mainButtonSender->property("duration").isValid() || mainButtonSender->property("duration").toString() == tr("ERROR")) 57 | return; 58 | 59 | double dur = mainButtonSender->property("duration").toDouble(); 60 | ui->doubleSpinBox->setValue(dur); 61 | 62 | qint64 secs = (int)dur % 60; 63 | qint64 minNum = (dur-secs)/60; 64 | qint64 mins = minNum % 60; 65 | qint64 hourNum = (minNum-mins)/ 60 ; 66 | qint64 hours = hourNum %24; 67 | qint64 days = (hourNum - hours)/ 24; 68 | 69 | ui->timeEdit->setTime(QTime(hours,mins,secs)); 70 | ui->spinBox->setValue(days); 71 | } 72 | -------------------------------------------------------------------------------- /resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | img/programIcon.png 4 | img/pinned.png 5 | img/unpinned.png 6 | img/darkTheme.png 7 | img/lightTheme.png 8 | style/dark.qss 9 | style/light.qss 10 | img/check.png 11 | img/check_light.png 12 | img/down_arrow_light.png 13 | img/left_arrow.png 14 | img/left_arrow_light.png 15 | img/right_arrow.png 16 | img/right_arrow_light.png 17 | img/up_arrow.png 18 | img/up_arrow_light.png 19 | img/plus.png 20 | img/close_red.png 21 | img/bottom_arrow_rounded.png 22 | img/down_arrow_rounded.png 23 | img/top_arrow_rounded.png 24 | img/up_arrow_rounded.png 25 | img/text.png 26 | img/wait.png 27 | img/save.png 28 | img/noscroll.png 29 | img/scroll.png 30 | img/down_arrow.png 31 | img/key.png 32 | img/systemCommand.png 33 | img/browseFolder.png 34 | img/cursor.png 35 | img/play.png 36 | img/cursor-cross.png 37 | img/crosshair.png 38 | img/startup.png 39 | img/anotherTask.png 40 | img/shortcut.png 41 | img/data.png 42 | img/anotherTask_light.png 43 | img/bottom_arrow_rounded_light.png 44 | img/browseFolder_light.png 45 | img/close_red_light.png 46 | img/cursor_light.png 47 | img/data_light.png 48 | img/down_arrow_rounded_light.png 49 | img/key_light.png 50 | img/save_light.png 51 | img/shortcut_light.png 52 | img/startup_light.png 53 | img/systemCommand_light.png 54 | img/text_light.png 55 | img/top_arrow_rounded_light.png 56 | img/up_arrow_rounded_light.png 57 | img/wait_light.png 58 | 59 | 60 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * Amir Hammmoutene (contact@amirhammoutene.dev) 3 | * March 2024 4 | * This program, made for Windows systems, can be used to schedule some action on users computer automatically. 5 | * Code is in C++ language, using Qt framework (version 6.7.1) 6 | * Open-source, under GNU general public license version 3 7 | ***/ 8 | 9 | #include "mainwindow.h" 10 | #include "actions/ActionParameters.h" 11 | 12 | #include 13 | #include 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | QApplication a(argc, argv); // Application as a Qt ui-framework object 18 | // Registering metatype to be used in signals/slots of Qt mecanism 19 | qRegisterMetaType(); 20 | qRegisterMetaType(); 21 | qRegisterMetaType(); 22 | qRegisterMetaType(); 23 | qRegisterMetaType(); 24 | 25 | a.setWindowIcon(QIcon(":/img/programIcon.png")); 26 | 27 | // Get local system language to apply translations is exists 28 | QString locale = QLocale::system().name().section('_', 0, 0); 29 | QTranslator translator; 30 | translator.load(QApplication::applicationDirPath()+"/"+QString("Tasket++_") + locale); 31 | QTranslator baseTranslator; 32 | baseTranslator.load(QApplication::applicationDirPath()+"/"+QString("qtbase_") + locale); 33 | a.installTranslator(&translator); 34 | a.installTranslator(&baseTranslator); 35 | 36 | // Main ui window 37 | std::shared_ptr w = MainWindow::getInstance(); 38 | w->buildTaskTabsManager(); 39 | 40 | // In case of program used with correct arguments, automatically run the task (usage : Tasket++.exe "TaskFileName" ) 41 | if(argc == 3 || argc == 4) 42 | { 43 | int delay = atoi(argv[2]); 44 | if(delay > 0) 45 | { 46 | if(argc == 4) 47 | { 48 | int timesToRun = atoi(argv[3]); 49 | if(timesToRun != 0) 50 | { 51 | w->hide(); 52 | w->autoRun(QString(argv[1]), delay,timesToRun); 53 | } 54 | else 55 | w->showWindow(); 56 | } 57 | else 58 | { 59 | w->hide(); 60 | w->autoRun(QString(argv[1]), delay); 61 | } 62 | } 63 | else 64 | w->showWindow(); 65 | } 66 | else 67 | w->showWindow(); 68 | 69 | return a.exec(); 70 | } 71 | -------------------------------------------------------------------------------- /ui/actionwidgets/RunningOtherTaskWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "RunningOtherTaskWidget.h" 2 | 3 | RunningOtherTaskWidget::RunningOtherTaskWidget(QWidget *parent) 4 | : AbstractActionWidget{parent} 5 | { 6 | 7 | } 8 | 9 | void RunningOtherTaskWidget::buildWidget() 10 | { 11 | if(m_centralWidget == nullptr) 12 | return; 13 | 14 | auto runOtherTaskaction = dynamic_cast(m_action.get()); 15 | 16 | QString runOtherTaskStr = tr("ERROR"); 17 | if(runOtherTaskaction != nullptr) 18 | { 19 | runOtherTaskStr = tr("Run another task"); 20 | 21 | m_mainButton->setToolTip(tr("Task name : ")+runOtherTaskaction->m_taskName+ tr("\nDelay : ")+QString::number(runOtherTaskaction->m_delay)+ tr("\nLoops : ")+QString::number(runOtherTaskaction->m_timesToRun)); 22 | ActionParameters params = runOtherTaskaction->generateParameters(); 23 | m_mainButton->setProperty("filename", params.m_taskName); 24 | m_mainButton->setProperty("delay", params.m_delay); 25 | m_mainButton->setProperty("loops", params.m_timesToRun); 26 | } 27 | 28 | m_mainButton->setObjectName("runAnotherTaskActionButton"); 29 | m_mainButton->setText(runOtherTaskStr); 30 | 31 | m_editRunOtherTaskDialog = new CreateRunningOtherTaskActionDialog(this); 32 | 33 | connect(m_mainButton, &QPushButton::released, m_editRunOtherTaskDialog, &CreateRunningOtherTaskActionDialog::showDialog); 34 | connect(m_editRunOtherTaskDialog, &CreateRunningOtherTaskActionDialog::sendRunningOtherTask, this, &RunningOtherTaskWidget::runningOtherTaskReceived); 35 | } 36 | 37 | void RunningOtherTaskWidget::runningOtherTaskReceived(QString filename, int delay, int timesOfLoop) 38 | { 39 | auto runOtherTaskaction = dynamic_cast(m_action.get()); 40 | if(runOtherTaskaction == nullptr) 41 | { 42 | m_mainButton->setToolTip("ERROR on access to action"); 43 | m_mainButton->setText("ERROR"); 44 | return; 45 | } 46 | 47 | ActionParameters params; 48 | params.m_taskName = filename; 49 | params.m_delay = delay; 50 | params.m_timesToRun = timesOfLoop; 51 | 52 | runOtherTaskaction->setParameters(params); 53 | 54 | m_mainButton->setToolTip(tr("Task name : ")+filename+ tr("\nDelay : ")+QString::number(delay)+ tr("\nLoops : ")+QString::number(timesOfLoop)); 55 | m_mainButton->setProperty("filename", params.m_taskName); 56 | m_mainButton->setProperty("delay", params.m_delay); 57 | m_mainButton->setProperty("loops", params.m_timesToRun); 58 | 59 | emit anyParamChanged(); 60 | } 61 | -------------------------------------------------------------------------------- /ui/getdialogs/getAutoRenameOptionDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | getAutoRenameOptionDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 507 10 | 72 11 | 12 | 13 | 14 | Set if new file should be created if file already exists 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 1 22 | 23 | 24 | 1 25 | 26 | 27 | 1 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | Automatically rename for a new filename if file already exists 36 | 37 | 38 | 39 | 40 | 41 | 42 | Qt::Orientation::Horizontal 43 | 44 | 45 | QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | buttonBox 55 | accepted() 56 | getAutoRenameOptionDialog 57 | accept() 58 | 59 | 60 | 248 61 | 254 62 | 63 | 64 | 157 65 | 274 66 | 67 | 68 | 69 | 70 | buttonBox 71 | rejected() 72 | getAutoRenameOptionDialog 73 | reject() 74 | 75 | 76 | 316 77 | 260 78 | 79 | 80 | 286 81 | 274 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /actions/CursorMovementsAction.cpp: -------------------------------------------------------------------------------- 1 | #include "CursorMovementsAction.h" 2 | #include "actions/ActionsTools.h" 3 | 4 | CursorMovementsAction::CursorMovementsAction() : AbstractAction() 5 | { 6 | e_type = ActionType::CursorMovements; 7 | } 8 | 9 | void CursorMovementsAction::runAction() 10 | { 11 | int timesToRun = m_timesToRun; 12 | 13 | begin: 14 | 15 | auto it = m_cursorMovementsList.begin(); 16 | while(it != m_cursorMovementsList.end()) 17 | { 18 | if(it->size() < 4) 19 | break; 20 | Sleep(it->at(0)); 21 | ActionsTools::moveCursorSimulate(it->at(2),it->at(3),it->at(1)); 22 | 23 | if(it == m_cursorMovementsList.begin()) 24 | { 25 | for(auto& pressStr : m_cursorMovementsOptionalKeysStroke) 26 | ActionsTools::keyStokeSimulate(pressStr, 0); 27 | } 28 | 29 | ++it; 30 | } 31 | 32 | for(auto& releaseStr : m_cursorMovementsOptionalKeysStroke) 33 | ActionsTools::keyStokeSimulate(releaseStr, KEYEVENTF_KEYUP); 34 | 35 | --timesToRun; 36 | if(timesToRun > 0) 37 | goto begin; 38 | } 39 | 40 | void CursorMovementsAction::setParameters(const ActionParameters ¶m) 41 | { 42 | m_cursorMovementsList = param.m_cursorMovementsList; 43 | m_movementsId = param.m_dataId; 44 | m_timesToRun = param.m_timesToRun; 45 | m_cursorMovementsOptionalKeysStroke = param.m_cursorMovementsOptionalKeysStroke; 46 | } 47 | 48 | std::shared_ptr CursorMovementsAction::deepCopy() const 49 | { 50 | auto actToReturn = std::make_shared(); 51 | actToReturn->m_cursorMovementsList = m_cursorMovementsList; 52 | actToReturn->m_movementsId = m_movementsId; 53 | actToReturn->m_timesToRun = m_timesToRun; 54 | actToReturn->m_cursorMovementsOptionalKeysStroke = m_cursorMovementsOptionalKeysStroke; 55 | actToReturn->m_refID = m_ID; 56 | return actToReturn; 57 | } 58 | 59 | ActionParameters CursorMovementsAction::generateParameters() const 60 | { 61 | ActionParameters param; 62 | param.m_cursorMovementsList = m_cursorMovementsList; 63 | param.m_dataId = m_movementsId; 64 | param.m_timesToRun = m_timesToRun; 65 | param.m_cursorMovementsOptionalKeysStroke = m_cursorMovementsOptionalKeysStroke; 66 | return param; 67 | } 68 | 69 | int CursorMovementsAction::computeOneExecutionDuration() 70 | { 71 | int returnedValue = 0; 72 | 73 | for(auto mov : m_cursorMovementsList) 74 | { 75 | if(mov.size() >= 2) 76 | returnedValue += mov[0] + mov[1]; 77 | } 78 | 79 | return returnedValue; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tasket++ 2 | 3 | version 1.6 (December 2025) 4 | 5 | Schedule automated simulations of actions you would perform on your PC. 6 | 7 | Example of Task 8 |
9 | More image previews 10 | Action types 11 | 12 | System commands Cursor Movements 13 | 14 | Run task at startup Key sequences 15 |
16 | 17 | ---------- 18 | 19 | Under GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 20 | Please read license.txt file 21 | 22 | We don't collect any data, please read private_policy.txt 23 | 24 | ---------- 25 | Details of version 1.6 : 26 | 27 | Stable version, fully functional 28 | 29 | Those actions simulations are available : 30 | 31 | - Keys sequence 32 | - Move Cursor 33 | - Paste text 34 | - Run Windows system specific command (open files, folders, executables, url, shut down pc, reboot, kill processes, create files...) 35 | - Wait 36 | - Run another task 37 | 38 | And other features like data management, scheduled tasks at system startup, create desktop shortcut to autorun a task... 39 | 40 | The goal in future versions is to include those features : 41 | 42 | - Play sound and show alert dialog actions 43 | - Add more Windows system specific command 44 | - Configure global hot keys to schedule a task to run while the user is on another application or video game 45 | 46 | Feedbacks and ideas for further actions are very welcome ! 47 | 48 | ---------- 49 | Available for install on Microsoft Store : 50 | https://apps.microsoft.com/store/detail/XP9CJLHWVXS49P 51 | 52 | Available as a portable version : 53 | https://files.amirhammoutene.dev/Tasket++/1.6/Tasket++_v1.6.zip 54 | 55 | Needs 30 MB disk space, available for Windows systems only 56 | 57 | ---------- 58 | Has been developed in C++ language, using Qt (6.9.3) framework 59 | 60 | Open Source 61 | 62 | GitHub link for sources : https://github.com/AmirHammouteneEI/ScheduledPasteAndKeys 63 | 64 | ---------- 65 | Conceived and developed by Amir Hammoutene (contact@amirhammoutene.dev). 66 | 67 | Initial work in February 2024. 68 | -------------------------------------------------------------------------------- /ui/various_dialogs/StartupTaskEditDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "StartupTaskEditDialog.h" 2 | #include "ui_StartupTaskEditDialog.h" 3 | #include "globals.h" 4 | 5 | #include 6 | #include 7 | 8 | StartupTaskEditDialog::StartupTaskEditDialog(QWidget *parent) 9 | : QDialog(parent) 10 | , ui(new Ui::StartupTaskEditDialog) 11 | { 12 | ui->setupUi(this); 13 | connect(ui->checkBox,&QCheckBox::toggled, this, &StartupTaskEditDialog::loopToggled); 14 | } 15 | 16 | StartupTaskEditDialog::~StartupTaskEditDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void StartupTaskEditDialog::showDialog() 22 | { 23 | fillExistingTasksTable(); 24 | ui->timeEdit->setTime(QTime(0,1,0)); 25 | ui->spinBox->setValue(0); 26 | ui->checkBox->setChecked(false); 27 | ui->spinBox_2->setValue(1); 28 | ui->spinBox_2->setEnabled(true); 29 | exec(); 30 | } 31 | 32 | void StartupTaskEditDialog::accept() 33 | { 34 | if(ui->tableWidget->selectedItems().count() == 0) 35 | { 36 | QMessageBox::warning(this, tr("No file selected"), G_Sentences::NoFileSelected()); 37 | return; 38 | }; 39 | if(ui->timeEdit->time() == QTime(0,0,0)) 40 | { 41 | QMessageBox::warning(this, tr("Delay can't be set to 0"), tr("The delay for the task to run after system startup can't be set to zero.")); 42 | return; 43 | } 44 | 45 | m_filename = ui->tableWidget->selectedItems().at(0)->text().chopped(5); 46 | m_delay = QTime(0,0,0).secsTo(ui->timeEdit->time()); 47 | m_delay+= ui->spinBox->value() * 86400; 48 | 49 | if(ui->checkBox->isChecked()) 50 | m_loopTimes = -1; 51 | else 52 | m_loopTimes = ui->spinBox_2->value(); 53 | 54 | QDialog::accept(); 55 | } 56 | 57 | void StartupTaskEditDialog::fillExistingTasksTable() 58 | { 59 | QDir tasksFolder = QApplication::applicationDirPath()+"/"+G_Files::TasksFolder; 60 | if(!tasksFolder.exists()) 61 | return; 62 | 63 | QStringList tasksNamesList = tasksFolder.entryList(QStringList() << "*"+G_Files::TasksFileExtension, QDir::Files); 64 | 65 | int nextLineNum, nextColumnNum; 66 | 67 | ui->tableWidget->setRowCount(0); 68 | 69 | for(int k = 0; k < tasksNamesList.size(); k++) 70 | { 71 | nextLineNum = k/2; 72 | nextColumnNum = k % 2; 73 | 74 | if(nextColumnNum == 0) 75 | ui->tableWidget->insertRow(ui->tableWidget->rowCount()); 76 | 77 | ui->tableWidget->setItem(nextLineNum, nextColumnNum, new QTableWidgetItem(tasksNamesList.at(k))); 78 | } 79 | } 80 | 81 | void StartupTaskEditDialog::loopToggled(bool state) 82 | { 83 | if(state) 84 | ui->spinBox_2->setEnabled(false); 85 | else 86 | ui->spinBox_2->setEnabled(true); 87 | } 88 | -------------------------------------------------------------------------------- /ActionWidgetsManager.cpp: -------------------------------------------------------------------------------- 1 | #include "ActionWidgetsManager.h" 2 | 3 | #include 4 | #include 5 | 6 | ActionWidgetsManager::ActionWidgetsManager(QVBoxLayout *parent) 7 | : QObject{parent},m_layout(parent) 8 | { 9 | if(m_layout == nullptr) 10 | { 11 | QMessageBox::critical(nullptr, tr("Internal Error"), 12 | tr("An internal error occured : err02\nlayout is null when affecting to ActionWidgetsManager !")); 13 | qApp->quit(); 14 | return; 15 | } 16 | } 17 | 18 | ActionWidgetsManager::~ActionWidgetsManager() 19 | { 20 | clear(); 21 | } 22 | 23 | int ActionWidgetsManager::appendWidget(AbstractActionWidget *actionWidget) 24 | { 25 | if(actionWidget == nullptr) 26 | return -1; 27 | 28 | m_actionWidgetsMap.insert(actionWidget->getActionID(),actionWidget); 29 | m_actionWidgetsDisplayOrderedList.append(actionWidget); 30 | return m_actionWidgetsMap.count(); 31 | } 32 | 33 | void ActionWidgetsManager::clear() 34 | { 35 | qDeleteAll(m_actionWidgetsMap); 36 | m_actionWidgetsMap.clear(); 37 | m_actionWidgetsDisplayOrderedList.clear(); 38 | } 39 | 40 | void ActionWidgetsManager::fullRefreshActionWidgets() 41 | { 42 | while(m_layout->count() != 0) 43 | m_layout->removeItem(m_layout->itemAt(0)); 44 | 45 | for(auto it = m_actionWidgetsDisplayOrderedList.begin(); it != m_actionWidgetsDisplayOrderedList.end();++it) 46 | { 47 | if((*it) != nullptr) 48 | m_layout->addWidget(*it); 49 | } 50 | 51 | m_layout->update(); 52 | } 53 | 54 | void ActionWidgetsManager::taskStopped() 55 | { 56 | for(auto it = m_actionWidgetsMap.keyValueBegin(); it != m_actionWidgetsMap.keyValueEnd(); ++it) 57 | { 58 | if(it->second == nullptr) 59 | continue; 60 | 61 | it->second->setRunningState(RunningState::NotExecuted); 62 | it->second->setEnabled(true); 63 | } 64 | } 65 | 66 | void ActionWidgetsManager::taskScheduled() 67 | { 68 | for(auto it = m_actionWidgetsMap.keyValueBegin(); it != m_actionWidgetsMap.keyValueEnd(); ++it) 69 | { 70 | if(it->second == nullptr) 71 | continue; 72 | 73 | it->second->setEnabled(false); 74 | } 75 | } 76 | 77 | void ActionWidgetsManager::receivedActionRunningState(unsigned int id) 78 | { 79 | AbstractActionWidget * widg = m_actionWidgetsMap.value(id,nullptr); 80 | if(widg != nullptr) 81 | widg->setRunningState(RunningState::Running); 82 | } 83 | 84 | void ActionWidgetsManager::receivedActionDoneState(unsigned int id) 85 | { 86 | AbstractActionWidget * widg = m_actionWidgetsMap.value(id,nullptr); 87 | if(widg != nullptr) 88 | widg->setRunningState(RunningState::Done); 89 | } 90 | -------------------------------------------------------------------------------- /ui/CustomPrimaryWidgets.h: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOMPRIMARYWIDGETS_H 2 | #define CUSTOMPRIMARYWIDGETS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "qevent.h" 11 | 12 | class NoWheelFocusSpinBox : public QSpinBox 13 | { 14 | Q_OBJECT 15 | public: 16 | 17 | NoWheelFocusSpinBox(QWidget *parent = 0):QSpinBox(parent) 18 | { 19 | setFocusPolicy(Qt::StrongFocus); 20 | } 21 | protected: 22 | virtual void wheelEvent(QWheelEvent *event) override 23 | { 24 | if(!hasFocus()) 25 | event->ignore(); 26 | else 27 | QSpinBox::wheelEvent(event); 28 | } 29 | }; 30 | 31 | class NoWheelFocusDoubleSpinBox : public QDoubleSpinBox 32 | { 33 | Q_OBJECT 34 | public: 35 | NoWheelFocusDoubleSpinBox(QWidget *parent = 0):QDoubleSpinBox(parent) 36 | { 37 | setFocusPolicy(Qt::StrongFocus); 38 | } 39 | protected: 40 | virtual void wheelEvent(QWheelEvent *event) override 41 | { 42 | if(!hasFocus()) 43 | event->ignore(); 44 | else 45 | QDoubleSpinBox::wheelEvent(event); 46 | } 47 | }; 48 | 49 | class NoWheelFocusTimeEdit : public QTimeEdit 50 | { 51 | Q_OBJECT 52 | public: 53 | NoWheelFocusTimeEdit(QWidget *parent = 0):QTimeEdit(parent) 54 | { 55 | setFocusPolicy(Qt::StrongFocus); 56 | } 57 | protected: 58 | virtual void wheelEvent(QWheelEvent *event) override 59 | { 60 | if(!hasFocus()) 61 | event->ignore(); 62 | else 63 | QTimeEdit::wheelEvent(event); 64 | } 65 | }; 66 | 67 | class NoWheelFocusDateTimeEdit : public QDateTimeEdit 68 | { 69 | Q_OBJECT 70 | public: 71 | NoWheelFocusDateTimeEdit(QWidget *parent = 0):QDateTimeEdit(parent) 72 | { 73 | setFocusPolicy(Qt::StrongFocus); 74 | } 75 | protected: 76 | virtual void wheelEvent(QWheelEvent *event) override 77 | { 78 | if(!hasFocus()) 79 | event->ignore(); 80 | else 81 | QDateTimeEdit::wheelEvent(event); 82 | } 83 | }; 84 | 85 | class NoFocusCellTableWidget : public QTableWidget 86 | { 87 | Q_OBJECT 88 | public: 89 | NoFocusCellTableWidget(QWidget *parent = 0):QTableWidget(parent) 90 | { 91 | setFocusPolicy(Qt::NoFocus); 92 | setMouseTracking(false); 93 | setItemDelegate(new QStyledItemDelegate(this)); 94 | } 95 | protected: 96 | virtual void mouseMoveEvent(QMouseEvent *event) override 97 | { 98 | event->ignore(); 99 | } 100 | }; 101 | 102 | #endif // CUSTOMPRIMARYWIDGETS_H 103 | -------------------------------------------------------------------------------- /ui/getdialogs/getDelayDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "getDelayDialog.h" 2 | #include "ui_getDelayDialog.h" 3 | 4 | #include 5 | #include 6 | 7 | getDelayDialog::getDelayDialog(QWidget *parent) 8 | : QDialog(parent) 9 | , ui(new Ui::getDelayDialog) 10 | { 11 | ui->setupUi(this); 12 | ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Schedule task for run")); 13 | 14 | connect(ui->delayGroup, &QGroupBox::clicked, this, &getDelayDialog::uncheckDateGroup); 15 | connect(ui->dateTimeGroup, &QGroupBox::clicked, this, &getDelayDialog::uncheckDelayGroup); 16 | connect(ui->dateTimeEdit, &NoWheelFocusDateTimeEdit::dateTimeChanged, this, &getDelayDialog::refreshDateDelayDetails); 17 | } 18 | 19 | getDelayDialog::~getDelayDialog() 20 | { 21 | delete ui; 22 | } 23 | 24 | void getDelayDialog::uncheckDelayGroup() 25 | { 26 | ui->delayGroup->setChecked(false); 27 | ui->dateTimeGroup->setChecked(true); 28 | } 29 | 30 | void getDelayDialog::uncheckDateGroup() 31 | { 32 | ui->dateTimeGroup->setChecked(false); 33 | ui->delayGroup->setChecked(true); 34 | } 35 | 36 | void getDelayDialog::accept() 37 | { 38 | m_savedDelayTimePart = ui->timeEdit->time(); 39 | m_savedDelayDayPart = ui->spinBox->value(); 40 | 41 | if(ui->delayGroup->isChecked()) 42 | { 43 | qint64 totalDelay = QTime(0,0,0).secsTo(m_savedDelayTimePart); 44 | totalDelay+= m_savedDelayDayPart * 86400; 45 | emit sendDelay(totalDelay); 46 | } 47 | else 48 | { 49 | QDateTime cur = QDateTime::currentDateTime(); 50 | qint64 delayInSec = cur.secsTo(ui->dateTimeEdit->dateTime()); 51 | if(delayInSec < 0) 52 | { 53 | QMessageBox::warning(this, tr("Date selected not correct"), tr("Date/time selected is not later than the current date/time, please set a correct date.")); 54 | return; 55 | } 56 | emit sendDelay(delayInSec); 57 | } 58 | 59 | QDialog::accept(); 60 | } 61 | 62 | void getDelayDialog::refreshDateDelayDetails(const QDateTime & datet) 63 | { 64 | qint64 dateDelay = QDateTime::currentDateTime().secsTo(datet); 65 | qint64 secs = dateDelay % 60; 66 | qint64 minNum = (dateDelay-secs)/60; 67 | qint64 mins = minNum % 60; 68 | qint64 hourNum = (minNum-mins)/ 60 ; 69 | qint64 hours = hourNum %24; 70 | qint64 days = (hourNum - hours)/ 24; 71 | ui->delayDetailsLabel->setText(QString::number(days)+tr(" days ")+QString::number(hours)+tr(" hours ") 72 | +QString::number(mins)+tr(" mins ")+QString::number(secs)+tr(" secs ")); 73 | } 74 | 75 | void getDelayDialog::showDialog() 76 | { 77 | ui->timeEdit->setTime(m_savedDelayTimePart); 78 | ui->spinBox->setValue(m_savedDelayDayPart); 79 | ui->dateTimeEdit->setDateTime(QDateTime::currentDateTime().addSecs(60)); 80 | refreshDateDelayDetails(ui->dateTimeEdit->dateTime()); 81 | show(); 82 | } 83 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "ui/various_dialogs/CreateLoadTaskDialog.h" 9 | #include "TaskTabsManager.h" 10 | #include "ui/various_dialogs/DataEditDialog.h" 11 | #include "ui/various_dialogs/StartupTasksDialog.h" 12 | #include "ui/various_dialogs/CreateAutorunDesktopShortcutDialog.h" 13 | 14 | QT_BEGIN_NAMESPACE 15 | namespace Ui { 16 | class MainWindow; 17 | } 18 | QT_END_NAMESPACE 19 | 20 | // SINGLETON 21 | class MainWindow : public QMainWindow 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | static std::shared_ptr getInstance(QWidget *parent = nullptr); 27 | MainWindow(MainWindow &other) = delete; 28 | void operator=(const MainWindow &) = delete; 29 | ~MainWindow(); 30 | void buildTaskTabsManager(); 31 | QTabWidget * getTabWidget(); // ui container of TaskTabs 32 | QShortcut *m_stopAllTasksShortcut = nullptr; 33 | public slots: 34 | void showWindow(QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger); // show mainwindow or systemtray icon menu (if right click on icon) 35 | void quitApp(); // stops all running tasks (forced), asks to saved modified tasks and quit the program 36 | void forceQuit(); 37 | void autoRun(const QString & filename, int delay, int loopTimes = 1); // automatically run a task in silent mode (no window appears) 38 | private slots: 39 | void swapStayOnTop(bool state); 40 | void swapAutoscrollMode(bool state); // autoscroll force the action widget visible when running the action 41 | void switchTheme(); // set stylesheet 42 | void taskTabPageClicked(int newIndex); 43 | void taskTabContextMenuRequest(QPoint point); 44 | void createAutorunShortcutFromDialogReceived(); 45 | protected : 46 | MainWindow(QWidget *parent = nullptr); 47 | struct SharedPtrMainWindow; 48 | static std::shared_ptr s_singleton; 49 | QSystemTrayIcon* m_sticon; 50 | void setTheme(); // simulate trigger on the appropriate theme button 51 | void buildToolBar(); 52 | void buildSystemTrayMenu(); 53 | void closeEvent(QCloseEvent *event) override; 54 | int m_windowWidth = 540; 55 | int m_windowHeight = 800; 56 | void geometrySet(); 57 | void loadSettings(); 58 | void saveSettings(); 59 | QAction *m_stayOnTopAction = nullptr; 60 | QAction * m_lightThemeAction = nullptr; 61 | QAction * m_darkThemeAction = nullptr; 62 | QAction * m_scrollAction = nullptr; 63 | QString m_currentThemeName = nullptr; 64 | CreateLoadTaskDialog *m_createLoadTaskDialog = nullptr; 65 | DataEditDialog *m_dataEditDialog = nullptr; 66 | StartupTasksDialog *m_startupTasksDialog = nullptr; 67 | CreateAutorunDesktopShortcutDialog *m_createDesktopShortcutDialog = nullptr; 68 | std::shared_ptr m_tasktabsManager = nullptr; 69 | QMenu *m_stmenu = nullptr; 70 | QToolBar *m_toolBar = nullptr; 71 | bool m_stMessageShown = false; 72 | private: 73 | Ui::MainWindow *ui; 74 | }; 75 | #endif // MAINWINDOW_H 76 | -------------------------------------------------------------------------------- /ui/actionwidgets/WaitWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "WaitWidget.h" 2 | #include "actions/WaitAction.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | WaitWidget::WaitWidget(QWidget *parent) 9 | : AbstractActionWidget{parent} 10 | { 11 | 12 | } 13 | 14 | void WaitWidget::buildWidget() 15 | { 16 | if(m_centralWidget == nullptr) 17 | return; 18 | 19 | auto waitaction = dynamic_cast(m_action.get()); 20 | 21 | QString durationStr = tr("ERROR"); 22 | if(waitaction != nullptr) 23 | durationStr = QString::number((double)waitaction->m_duration); 24 | 25 | m_mainButton->setObjectName("waitActionButton"); 26 | m_mainButton->setText(tr("Wait for ") + durationStr + tr(" secs")); 27 | m_mainButton->setToolTip(durationStr+tr(" seconds")); 28 | m_mainButton->setProperty("duration", durationStr); 29 | 30 | m_editDurationDialog = new CreateWaitActionDialog(this); 31 | 32 | connect(m_mainButton, &QPushButton::released, m_editDurationDialog, &CreateWaitActionDialog::showDialog); 33 | connect(m_editDurationDialog, &CreateWaitActionDialog::sendDuration, this, &WaitWidget::durationReceived); 34 | 35 | } 36 | 37 | void WaitWidget::changedRunningState() 38 | { 39 | refreshTimeRemainingText(QDateTime::currentDateTime()); 40 | } 41 | 42 | void WaitWidget::refreshTimeRemainingText(const QDateTime &departureDate) 43 | { 44 | if(m_runningState == RunningState::NotExecuted || m_runningState == RunningState::Done) 45 | { 46 | m_infoLabel->setText(""); 47 | return; 48 | } 49 | 50 | auto waitaction = dynamic_cast(m_action.get()); 51 | if(waitaction == nullptr) 52 | return; 53 | 54 | QDateTime finishDate = departureDate.addSecs(waitaction->m_duration); 55 | qint64 dateDelay = QDateTime::currentDateTime().secsTo(finishDate); 56 | 57 | if(dateDelay < 5) 58 | { 59 | m_infoLabel->setText(tr("Remaining less than 5 seconds")); 60 | m_infoLabel->setFixedSize(m_infoLabel->sizeHint()); 61 | return; 62 | } 63 | 64 | qint64 secs = dateDelay % 60; 65 | qint64 minNum = (dateDelay-secs)/60; 66 | qint64 mins = minNum % 60; 67 | qint64 hourNum = (minNum-mins)/ 60 ; 68 | qint64 hours = hourNum %24; 69 | qint64 days = (hourNum - hours)/ 24; 70 | m_infoLabel->setText(QString::number(days)+tr(" days ")+QString::number(hours)+tr(" hours ") 71 | +QString::number(mins)+tr(" mins ")+QString::number(secs)+tr(" secs")); 72 | m_infoLabel->setFixedSize(m_infoLabel->sizeHint()); 73 | QTimer::singleShot(200, this, [=]() {refreshTimeRemainingText(departureDate);}); 74 | } 75 | 76 | void WaitWidget::durationReceived(long double dur) 77 | { 78 | auto waitaction = dynamic_cast(m_action.get()); 79 | if(waitaction == nullptr) 80 | { 81 | m_mainButton->setToolTip("ERROR on access to action"); 82 | m_mainButton->setText("Wait for ERROR secs"); 83 | return; 84 | } 85 | 86 | waitaction->m_duration = dur; 87 | QString durationStr = QString::number((double)dur); 88 | m_mainButton->setText(tr("Wait for ") + durationStr + tr(" secs")); 89 | m_mainButton->setToolTip(durationStr + tr(" seconds")); 90 | m_mainButton->setProperty("duration", durationStr); 91 | 92 | emit anyParamChanged(); 93 | } 94 | -------------------------------------------------------------------------------- /ui/getdialogs/getImagePathDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | getImagePathDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 649 10 | 98 11 | 12 | 13 | 14 | Set the image file option 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 1 22 | 23 | 24 | 1 25 | 26 | 27 | 1 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | Set the file where the screenshot image will be saved : 36 | 37 | 38 | 39 | 40 | 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | C:/... 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 0 57 | 58 | 59 | 60 | Browse a directory in order to help to set the path... 61 | 62 | 63 | 64 | 24 65 | 24 66 | 67 | 68 | 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::Orientation::Horizontal 79 | 80 | 81 | QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | buttonBox 91 | accepted() 92 | getImagePathDialog 93 | accept() 94 | 95 | 96 | 248 97 | 254 98 | 99 | 100 | 157 101 | 274 102 | 103 | 104 | 105 | 106 | buttonBox 107 | rejected() 108 | getImagePathDialog 109 | reject() 110 | 111 | 112 | 316 113 | 260 114 | 115 | 116 | 286 117 | 274 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /ui/getdialogs/getFilePathDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | getFilePathDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 663 10 | 102 11 | 12 | 13 | 14 | Set the file option 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 1 22 | 23 | 24 | 1 25 | 26 | 27 | 1 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | Set the file (existing or not) on which you would like the operation to proceed : 36 | 37 | 38 | 39 | 40 | 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | C:/... 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 0 57 | 58 | 59 | 60 | Browse a directory in order to help to set the path... 61 | 62 | 63 | 64 | 24 65 | 24 66 | 67 | 68 | 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::Orientation::Horizontal 79 | 80 | 81 | QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | buttonBox 91 | accepted() 92 | getFilePathDialog 93 | accept() 94 | 95 | 96 | 230 97 | 74 98 | 99 | 100 | 230 101 | 47 102 | 103 | 104 | 105 | 106 | buttonBox 107 | rejected() 108 | getFilePathDialog 109 | reject() 110 | 111 | 112 | 230 113 | 74 114 | 115 | 116 | 230 117 | 47 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /ui/getdialogs/getProgramPathDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | getProgramPathDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 670 10 | 98 11 | 12 | 13 | 14 | Set the program option 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 1 22 | 23 | 24 | 1 25 | 26 | 27 | 1 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | Set the program on which you would like the operation to proceed : 36 | 37 | 38 | 39 | 40 | 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | C:/... 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 0 57 | 58 | 59 | 60 | Browse a directory in order to help to set the path... 61 | 62 | 63 | 64 | 24 65 | 24 66 | 67 | 68 | 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::Orientation::Horizontal 79 | 80 | 81 | QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | buttonBox 91 | accepted() 92 | getProgramPathDialog 93 | accept() 94 | 95 | 96 | 242 97 | 58 98 | 99 | 100 | 242 101 | 35 102 | 103 | 104 | 105 | 106 | buttonBox 107 | rejected() 108 | getProgramPathDialog 109 | reject() 110 | 111 | 112 | 242 113 | 58 114 | 115 | 116 | 242 117 | 35 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /ui/getdialogs/getFolderPathDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | getFolderPathDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 713 10 | 103 11 | 12 | 13 | 14 | Set the directory option 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 1 22 | 23 | 24 | 1 25 | 26 | 27 | 1 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | Set the directory (existing or not) on which you would like the operation to proceed : 36 | 37 | 38 | 39 | 40 | 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | C:/... 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 0 57 | 58 | 59 | 60 | Browse a directory in order to help to set the path... 61 | 62 | 63 | 64 | 24 65 | 24 66 | 67 | 68 | 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::Orientation::Horizontal 79 | 80 | 81 | QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | buttonBox 91 | accepted() 92 | getFolderPathDialog 93 | accept() 94 | 95 | 96 | 248 97 | 254 98 | 99 | 100 | 157 101 | 274 102 | 103 | 104 | 105 | 106 | buttonBox 107 | rejected() 108 | getFolderPathDialog 109 | reject() 110 | 111 | 112 | 316 113 | 260 114 | 115 | 116 | 286 117 | 274 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /actions/KeysSequenceAction.cpp: -------------------------------------------------------------------------------- 1 | #include "KeysSequenceAction.h" 2 | #include "actions/ActionsTools.h" 3 | 4 | KeysSequenceAction::KeysSequenceAction() : AbstractAction() 5 | { 6 | e_type = ActionType::KeysSequence; 7 | } 8 | 9 | void KeysSequenceAction::runAction() 10 | { 11 | int timesToRun = m_timesToRun; 12 | 13 | begin: 14 | 15 | auto it = m_keysStrokeTimeline.begin(); 16 | while(it != m_keysStrokeTimeline.end()) 17 | { 18 | int time = it.key(); 19 | auto vecOfStrokes = it.value(); 20 | if(vecOfStrokes.size() < 2) 21 | continue; 22 | 23 | for(auto& pressStr : vecOfStrokes[0]) 24 | ActionsTools::keyStokeSimulate(pressStr, 0); 25 | 26 | for(auto& releaseStr : vecOfStrokes[1]) 27 | ActionsTools::keyStokeSimulate(releaseStr, KEYEVENTF_KEYUP); 28 | ++it; 29 | if(it != m_keysStrokeTimeline.end()) 30 | Sleep(it.key() - time); 31 | } 32 | 33 | Sleep(100); 34 | 35 | --timesToRun; 36 | if(timesToRun > 0) 37 | goto begin; 38 | } 39 | 40 | void KeysSequenceAction::setParameters(const ActionParameters ¶m) 41 | { 42 | m_keysSeqMap = param.m_keysSeqMap; 43 | m_sequenceId = param.m_dataId; 44 | m_timesToRun = param.m_timesToRun; 45 | } 46 | 47 | std::shared_ptr KeysSequenceAction::deepCopy() const 48 | { 49 | auto actToReturn = std::make_shared(); 50 | actToReturn->m_keysSeqMap = m_keysSeqMap; 51 | actToReturn->m_sequenceId = m_sequenceId; 52 | actToReturn->m_keysStrokeTimeline = m_keysStrokeTimeline; 53 | actToReturn->m_timesToRun = m_timesToRun; 54 | actToReturn->m_refID = m_ID; 55 | return actToReturn; 56 | } 57 | 58 | ActionParameters KeysSequenceAction::generateParameters() const 59 | { 60 | ActionParameters param; 61 | param.m_keysSeqMap = m_keysSeqMap; 62 | param.m_dataId = m_sequenceId; 63 | param.m_timesToRun = m_timesToRun; 64 | return param; 65 | } 66 | 67 | void KeysSequenceAction::generateTimeline() 68 | { 69 | m_keysStrokeTimeline.clear(); 70 | for(auto [key,val] : m_keysSeqMap.asKeyValueRange()) 71 | { 72 | int releaseKey = key + val.first; // time + release after time 73 | 74 | if(m_keysStrokeTimeline.contains(key)) // in that case, we append keys in the press stroke keys list 75 | { 76 | auto vecOfStrokes = m_keysStrokeTimeline.value(key); 77 | if(vecOfStrokes.size() == 2) 78 | { 79 | vecOfStrokes[0].append(val.second); 80 | m_keysStrokeTimeline.insert(key, vecOfStrokes); 81 | } 82 | } 83 | else // else we create the entry with the pressed keys 84 | { 85 | QVector vecToInsert; 86 | vecToInsert.append(val.second); 87 | vecToInsert.append(QStringList()); 88 | m_keysStrokeTimeline.insert(key,vecToInsert); 89 | } 90 | 91 | if(m_keysStrokeTimeline.contains(releaseKey)) // in that case, we append keys in the release stroke keys list 92 | { 93 | auto vecOfStrokes = m_keysStrokeTimeline.value(releaseKey); 94 | if(vecOfStrokes.size() == 2) 95 | { 96 | vecOfStrokes[1].append(val.second); 97 | m_keysStrokeTimeline.insert(releaseKey, vecOfStrokes); 98 | } 99 | } 100 | else // else we create the entry with the release keys 101 | { 102 | QVector vecToInsert; 103 | vecToInsert.append(QStringList()); 104 | vecToInsert.append(val.second); 105 | m_keysStrokeTimeline.insert(releaseKey,vecToInsert); 106 | } 107 | } 108 | } 109 | 110 | int KeysSequenceAction::computeOneExecutionDuration() 111 | { 112 | int returnedValue = 0; 113 | 114 | for(auto [key,val] : m_keysSeqMap.asKeyValueRange()) 115 | { 116 | int thisKeyStops = key + val.first; 117 | if(thisKeyStops > returnedValue) 118 | returnedValue = thisKeyStops; 119 | } 120 | 121 | return returnedValue+100; // 0.1 second as the minimal time wait for each execution 122 | } 123 | -------------------------------------------------------------------------------- /ui/various_dialogs/CreateAutorunDesktopShortcutDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "CreateAutorunDesktopShortcutDialog.h" 2 | #include "ui_CreateAutorunDesktopShortcutDialog.h" 3 | #include "globals.h" 4 | 5 | #include 6 | #include 7 | 8 | CreateAutorunDesktopShortcutDialog::CreateAutorunDesktopShortcutDialog(QWidget *parent) 9 | : QDialog(parent) 10 | , ui(new Ui::CreateAutorunDesktopShortcutDialog) 11 | { 12 | ui->setupUi(this); 13 | connect(ui->checkBox,&QCheckBox::toggled, this, &CreateAutorunDesktopShortcutDialog::loopToggled); 14 | connect(ui->tableWidget, &QTableWidget::cellClicked, this, &CreateAutorunDesktopShortcutDialog::onFileSelected); 15 | } 16 | 17 | CreateAutorunDesktopShortcutDialog::~CreateAutorunDesktopShortcutDialog() 18 | { 19 | delete ui; 20 | } 21 | 22 | void CreateAutorunDesktopShortcutDialog::showDialog() 23 | { 24 | fillExistingTasksTable(); 25 | ui->timeEdit->setTime(QTime(0,1,0)); 26 | ui->spinBox->setValue(0); 27 | ui->checkBox->setChecked(false); 28 | ui->spinBox_2->setValue(1); 29 | ui->spinBox_2->setEnabled(true); 30 | ui->lineEdit->setText(""); 31 | exec(); 32 | } 33 | 34 | void CreateAutorunDesktopShortcutDialog::accept() 35 | { 36 | m_shortcutname = ui->lineEdit->text(); 37 | if(ui->tableWidget->selectedItems().count() == 0) 38 | { 39 | QMessageBox::warning(this, tr("No file selected"), G_Sentences::NoFileSelected()); 40 | return; 41 | }; 42 | if(ui->timeEdit->time() == QTime(0,0,0)) 43 | { 44 | QMessageBox::warning(this, tr("Delay can't be set to 0"), tr("The delay for the task to run after using a desktop shortcut can't be set to zero.")); 45 | return; 46 | } 47 | if(m_shortcutname.isEmpty()) 48 | { 49 | QMessageBox::warning(this, tr("Empty name"), tr("Shortcut must have a name.")); 50 | return; 51 | } 52 | if(doesFilenameContainForbiddenChar(m_shortcutname)) 53 | { 54 | QMessageBox::warning(this, tr("Forbidden character"), G_Sentences::ForbiddenCharacter()); 55 | return; 56 | } 57 | 58 | m_filename = ui->tableWidget->selectedItems().at(0)->text().chopped(5); 59 | m_delay = QTime(0,0,0).secsTo(ui->timeEdit->time()); 60 | m_delay+= ui->spinBox->value() * 86400; 61 | 62 | if(ui->checkBox->isChecked()) 63 | m_loopTimes = -1; 64 | else 65 | m_loopTimes = ui->spinBox_2->value(); 66 | 67 | QDialog::accept(); 68 | } 69 | 70 | void CreateAutorunDesktopShortcutDialog::fillExistingTasksTable() 71 | { 72 | QDir tasksFolder = QApplication::applicationDirPath()+"/"+G_Files::TasksFolder; 73 | if(!tasksFolder.exists()) 74 | return; 75 | 76 | QStringList tasksNamesList = tasksFolder.entryList(QStringList() << "*"+G_Files::TasksFileExtension, QDir::Files); 77 | 78 | int nextLineNum, nextColumnNum; 79 | 80 | ui->tableWidget->setRowCount(0); 81 | 82 | for(int k = 0; k < tasksNamesList.size(); k++) 83 | { 84 | nextLineNum = k/2; 85 | nextColumnNum = k % 2; 86 | 87 | if(nextColumnNum == 0) 88 | ui->tableWidget->insertRow(ui->tableWidget->rowCount()); 89 | 90 | ui->tableWidget->setItem(nextLineNum, nextColumnNum, new QTableWidgetItem(tasksNamesList.at(k))); 91 | } 92 | } 93 | 94 | void CreateAutorunDesktopShortcutDialog::loopToggled(bool state) 95 | { 96 | if(state) 97 | ui->spinBox_2->setEnabled(false); 98 | else 99 | ui->spinBox_2->setEnabled(true); 100 | } 101 | 102 | void CreateAutorunDesktopShortcutDialog::onFileSelected() 103 | { 104 | if(ui->tableWidget->selectedItems().count() == 0) 105 | { 106 | return; 107 | } 108 | 109 | ui->lineEdit->setText("run "+ui->tableWidget->selectedItems().at(0)->text().chopped(5)); 110 | } 111 | 112 | bool CreateAutorunDesktopShortcutDialog::doesFilenameContainForbiddenChar(const QString &filename) 113 | { 114 | if(filename.contains("<") || filename.contains(">") || filename.contains(":") 115 | || filename.contains("\\") || filename.contains("\"") || filename.contains("|") 116 | || filename.contains("?") || filename.contains("*") || filename.contains("/")) 117 | { 118 | return true; 119 | } 120 | return false; 121 | } 122 | -------------------------------------------------------------------------------- /ui/tablewidgets/SentencesTableWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "SentencesTableWidget.h" 2 | #include "globals.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | SentencesTableWidget::SentencesTableWidget(QWidget *parent) 9 | : NoFocusCellTableWidget{parent} 10 | { 11 | m_sentenceEditDialog = new SentenceSelectedEditDialog(this); 12 | connect(m_sentenceEditDialog, &QDialog::accepted, this, &SentencesTableWidget::editFromDialogReceived); 13 | connect(this, &QTableWidget::cellDoubleClicked, this, &SentencesTableWidget::editSentenceSelected); 14 | } 15 | 16 | void SentencesTableWidget::createSentenceReceived() 17 | { 18 | m_sentenceEditDialog->setEditable(true); 19 | m_sentenceEditDialog->setIdentity(""); 20 | m_sentenceEditDialog->setContent(""); 21 | m_sentenceEditDialog->show(); 22 | } 23 | 24 | void SentencesTableWidget::editSentenceSelected(int row, int) 25 | { 26 | QTableWidgetItem *idItem = item(row,0); 27 | if(idItem == nullptr) 28 | return; 29 | 30 | QString trueId = idItem->text().remove(0,1); 31 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 32 | m_sentenceEditDialog->setEditable(m_belongsToDataEditDialog); 33 | m_sentenceEditDialog->setIdentity(trueId); 34 | m_sentenceEditDialog->setContent(settings.value(G_Files::SentencesDataCategory + trueId).toString()); 35 | m_sentenceEditDialog->show(); 36 | } 37 | 38 | void SentencesTableWidget::editFromDialogReceived() 39 | { 40 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 41 | settings.setValue(G_Files::SentencesDataCategory+m_sentenceEditDialog->identity(), 42 | m_sentenceEditDialog->content()); 43 | refresh(); 44 | 45 | selectSentenceFromIdentity(m_sentenceEditDialog->identity()); 46 | } 47 | 48 | void SentencesTableWidget::removeSentenceReceived() 49 | { 50 | QItemSelectionModel *selection = selectionModel(); 51 | if(!selection->hasSelection()) 52 | { 53 | QMessageBox::warning(this, tr("No sentence selected"),G_Sentences::NoSetenceSelected()); 54 | return; 55 | } 56 | 57 | if(QMessageBox::question(this, tr("Confirm removing sentence"), tr("You are about to remove this sentence from data stored, are you sure ?"), 58 | QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::Cancel), QMessageBox::StandardButton(QMessageBox::Cancel)) == QMessageBox::Cancel) 59 | return; 60 | 61 | int row = selection->selectedRows().at(0).row(); 62 | QTableWidgetItem *idItem = item(row,0); 63 | if(idItem == nullptr) 64 | return; 65 | QString trueId = idItem->text().remove(0,1); 66 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 67 | settings.remove(G_Files::SentencesDataCategory + trueId); 68 | 69 | refresh(); 70 | } 71 | 72 | void SentencesTableWidget::refresh() 73 | { 74 | clearContents(); 75 | setRowCount(0); 76 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 77 | QStringList keys = settings.allKeys(); 78 | for(const auto &key : keys) 79 | { 80 | if(key.startsWith(G_Files::SentencesDataCategory)) 81 | { 82 | insertRow(rowCount()); 83 | 84 | QString id = key; 85 | id.remove(G_Files::SentencesDataCategory); 86 | setItem(rowCount()-1,0,new QTableWidgetItem("#"+id)); 87 | 88 | QTableWidgetItem *contentItem = new QTableWidgetItem(); 89 | QString content = settings.value(key).toString(); 90 | contentItem->setToolTip(content); 91 | contentItem->setText(content.simplified()); 92 | setItem(rowCount()-1,1,contentItem); 93 | } 94 | } 95 | } 96 | 97 | void SentencesTableWidget::selectSentenceFromIdentity(const QString &id) 98 | { 99 | QTableWidgetItem *idItem = nullptr; 100 | int rowFound = -1; 101 | for(int k=0; k< rowCount(); ++k) 102 | { 103 | idItem = item(k,0); 104 | if(idItem != nullptr && idItem->text() == "#"+id) 105 | { 106 | rowFound = k; 107 | break; 108 | } 109 | } 110 | 111 | if(rowFound >= 0) 112 | { 113 | selectRow(rowFound); 114 | scrollToItem(idItem,QAbstractItemView::PositionAtCenter); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /ui/actionwidgets/SystemCommandWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "SystemCommandWidget.h" 2 | 3 | SystemCommandWidget::SystemCommandWidget(QWidget *parent) 4 | : AbstractActionWidget{parent} 5 | { 6 | 7 | } 8 | 9 | void SystemCommandWidget::buildWidget() 10 | { 11 | if(m_centralWidget == nullptr) 12 | return; 13 | 14 | auto sysCmdaction = dynamic_cast(m_action.get()); 15 | 16 | QString sysCmdTypeStr = tr("ERROR"); 17 | if(sysCmdaction != nullptr) 18 | { 19 | sysCmdTypeStr = fromSysCmdTypeToDiplayedStr(sysCmdaction->e_sysCommandType); 20 | 21 | m_mainButton->setToolTip(sysCmdTypeStr + "\nOption 1 : "+sysCmdaction->m_param1+ "\nOption 2 : "+sysCmdaction->m_param2); 22 | 23 | ActionParameters params = sysCmdaction->generateParameters(); 24 | m_mainButton->setProperty("type", params.m_sysCmdTypeStr); 25 | m_mainButton->setProperty("param1", params.m_sysCmdParam1); 26 | m_mainButton->setProperty("param2", params.m_sysCmdParam2); 27 | m_mainButton->setProperty("displayedStr", sysCmdTypeStr); 28 | } 29 | 30 | m_mainButton->setObjectName("syscommandActionButton"); 31 | m_mainButton->setText(sysCmdTypeStr); 32 | 33 | m_editSysCmdDialog = new CreateSystemCommandActionDialog(this); 34 | 35 | connect(m_mainButton, &QPushButton::released, m_editSysCmdDialog, &CreateSystemCommandActionDialog::showDialog); 36 | connect(m_editSysCmdDialog, &CreateSystemCommandActionDialog::sendSystemCommand, this, &SystemCommandWidget::systemCommandReceived); 37 | } 38 | 39 | void SystemCommandWidget::systemCommandReceived(QString sysCmdType, QString param1, QString param2) 40 | { 41 | auto sysCmdaction = dynamic_cast(m_action.get()); 42 | if(sysCmdaction == nullptr) 43 | { 44 | m_mainButton->setToolTip("ERROR on access to action"); 45 | m_mainButton->setText("ERROR"); 46 | return; 47 | } 48 | 49 | ActionParameters params; 50 | params.m_sysCmdTypeStr = sysCmdType; 51 | params.m_sysCmdParam1 = param1; 52 | params.m_sysCmdParam2 = param2; 53 | 54 | sysCmdaction->setParameters(params); 55 | QString displayedStr = fromSysCmdTypeToDiplayedStr(sysCmdaction->e_sysCommandType); 56 | m_mainButton->setText(displayedStr); 57 | m_mainButton->setToolTip(displayedStr + "\n\nOption 1 : "+param1+ "\nOption 2 : "+param2); 58 | m_mainButton->setProperty("type", params.m_sysCmdTypeStr); 59 | m_mainButton->setProperty("param1", params.m_sysCmdParam1); 60 | m_mainButton->setProperty("param2", params.m_sysCmdParam2); 61 | 62 | emit anyParamChanged(); 63 | } 64 | 65 | QString SystemCommandWidget::fromSysCmdTypeToDiplayedStr(SystemCommandType t) 66 | { 67 | QString sysCmdTypeStr; 68 | if(t == SystemCommandType::ShutDown) 69 | sysCmdTypeStr = tr("Shut down the PC"); 70 | else if(t == SystemCommandType::Restart) 71 | sysCmdTypeStr = tr("Restart the PC"); 72 | else if(t == SystemCommandType::LogOff) 73 | sysCmdTypeStr = tr("Log off user session"); 74 | else if(t == SystemCommandType::ChangeAudioVolume) 75 | sysCmdTypeStr = tr("Change PC audio volume"); 76 | else if(t == SystemCommandType::ChangeDefaultAudioDevice) 77 | sysCmdTypeStr = tr("Change the default audio device"); 78 | else if(t == SystemCommandType::KillProcess) 79 | sysCmdTypeStr = tr("Kill a process"); 80 | else if(t == SystemCommandType::QuitSelfProgram) 81 | sysCmdTypeStr = tr("Quit Tasket++"); 82 | else if(t == SystemCommandType::CreateFolder) 83 | sysCmdTypeStr = tr("Create a folder"); 84 | else if(t == SystemCommandType::DeleteFolder) 85 | sysCmdTypeStr = tr("Delete a folder"); 86 | else if(t == SystemCommandType::CreateOneFile) 87 | sysCmdTypeStr = tr("Create a file"); 88 | else if(t == SystemCommandType::DeleteOneFile) 89 | sysCmdTypeStr = tr("Delete a file"); 90 | else if(t == SystemCommandType::TakeScreenshot) 91 | sysCmdTypeStr = tr("Take a screenshot"); 92 | else if(t == SystemCommandType::PrintActualScreen) 93 | sysCmdTypeStr = tr("Print the actual screen display"); 94 | else if(t == SystemCommandType::OpenFile) 95 | sysCmdTypeStr = tr("Open a file"); 96 | else if(t == SystemCommandType::ExecuteProgram) 97 | sysCmdTypeStr = tr("Execute a program"); 98 | else if(t == SystemCommandType::OpenUrl) 99 | sysCmdTypeStr = tr("Open an URL"); 100 | else if(t == SystemCommandType::OpenFolder) 101 | sysCmdTypeStr = tr("Open a folder"); 102 | else if(t == SystemCommandType::CopyOneFile) 103 | sysCmdTypeStr = tr("Copy a file"); 104 | 105 | return sysCmdTypeStr; 106 | } 107 | -------------------------------------------------------------------------------- /ui/createactiondialogs/CreateRunningOtherTaskActionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "CreateRunningOtherTaskActionDialog.h" 2 | #include "ui_CreateRunningOtherTaskActionDialog.h" 3 | #include "globals.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | CreateRunningOtherTaskActionDialog::CreateRunningOtherTaskActionDialog(QWidget *parent) 10 | : QDialog(parent) 11 | , ui(new Ui::CreateRunningOtherTaskActionDialog) 12 | { 13 | ui->setupUi(this); 14 | connect(ui->checkBox_2,&QCheckBox::toggled, this, &CreateRunningOtherTaskActionDialog::loopToggled); 15 | } 16 | 17 | CreateRunningOtherTaskActionDialog::~CreateRunningOtherTaskActionDialog() 18 | { 19 | delete ui; 20 | } 21 | 22 | void CreateRunningOtherTaskActionDialog::showDialog() 23 | { 24 | fillExistingTasksTable(); 25 | ui->timeEdit_2->setTime(QTime(0,1,0)); 26 | ui->spinBox_4->setValue(0); 27 | ui->checkBox_2->setChecked(false); 28 | ui->spinBox_3->setValue(1); 29 | ui->spinBox_3->setEnabled(true); 30 | show(); 31 | 32 | // if shows from an existing Running Other Task Widget 33 | auto mainButtonSender = qobject_cast(sender()); 34 | if(mainButtonSender == nullptr) 35 | return; 36 | 37 | if(!mainButtonSender->property("filename").isValid() || !mainButtonSender->property("delay").isValid() || 38 | !mainButtonSender->property("loops").isValid()) 39 | return; 40 | 41 | m_filename = mainButtonSender->property("filename").toString(); 42 | m_delay = mainButtonSender->property("delay").toInt(); 43 | m_loopTimes = mainButtonSender->property("loops").toInt(); 44 | 45 | qint64 secs = (int)m_delay % 60; 46 | qint64 minNum = (m_delay-secs)/60; 47 | qint64 mins = minNum % 60; 48 | qint64 hourNum = (minNum-mins)/ 60 ; 49 | qint64 hours = hourNum %24; 50 | qint64 days = (hourNum - hours)/ 24; 51 | 52 | ui->timeEdit_2->setTime(QTime(hours,mins,secs)); 53 | ui->spinBox_4->setValue(days); 54 | 55 | if(m_loopTimes < 0) 56 | { 57 | ui->spinBox_3->setEnabled(false); 58 | ui->checkBox_2->setChecked(true); 59 | } 60 | else 61 | { 62 | ui->spinBox_3->setValue(m_loopTimes); 63 | } 64 | 65 | QTableWidgetItem *idItem = nullptr; 66 | int rowFound = -1, columnFound = -1; 67 | for(int k=0; ktableWidget->rowCount(); ++k) 68 | { 69 | for(int l=0; ltableWidget->columnCount(); ++l) 70 | { 71 | idItem = ui->tableWidget->item(k,l); 72 | if(idItem != nullptr && idItem->text() == m_filename+G_Files::TasksFileExtension) 73 | { 74 | rowFound = k; 75 | columnFound = l; 76 | break; 77 | } 78 | } 79 | if(rowFound > -1) 80 | break; 81 | } 82 | 83 | if(rowFound > -1) 84 | { 85 | auto index = ui->tableWidget->model()->index(rowFound, columnFound); 86 | ui->tableWidget->selectionModel()->select(index, QItemSelectionModel::SelectCurrent); 87 | ui->tableWidget->scrollToItem(idItem,QAbstractItemView::PositionAtCenter); 88 | } 89 | 90 | } 91 | 92 | void CreateRunningOtherTaskActionDialog::accept() 93 | { 94 | if(ui->tableWidget->selectedItems().count() == 0) 95 | { 96 | QMessageBox::warning(this, tr("No file selected"), G_Sentences::NoFileSelected()); 97 | return; 98 | }; 99 | 100 | 101 | m_filename = ui->tableWidget->selectedItems().at(0)->text().chopped(5); 102 | m_delay = QTime(0,0,0).secsTo(ui->timeEdit_2->time()); 103 | m_delay+= ui->spinBox_4->value() * 86400; 104 | 105 | if(ui->checkBox_2->isChecked()) 106 | m_loopTimes = -1; 107 | else 108 | m_loopTimes = ui->spinBox_3->value(); 109 | 110 | emit sendRunningOtherTask(m_filename,m_delay,m_loopTimes); 111 | QDialog::accept(); 112 | } 113 | 114 | void CreateRunningOtherTaskActionDialog::fillExistingTasksTable() 115 | { 116 | QDir tasksFolder = QApplication::applicationDirPath()+"/"+G_Files::TasksFolder; 117 | if(!tasksFolder.exists()) 118 | return; 119 | 120 | QStringList tasksNamesList = tasksFolder.entryList(QStringList() << "*"+G_Files::TasksFileExtension, QDir::Files); 121 | 122 | int nextLineNum, nextColumnNum; 123 | 124 | ui->tableWidget->setRowCount(0); 125 | 126 | for(int k = 0; k < tasksNamesList.size(); k++) 127 | { 128 | nextLineNum = k/2; 129 | nextColumnNum = k % 2; 130 | 131 | if(nextColumnNum == 0) 132 | ui->tableWidget->insertRow(ui->tableWidget->rowCount()); 133 | 134 | ui->tableWidget->setItem(nextLineNum, nextColumnNum, new QTableWidgetItem(tasksNamesList.at(k))); 135 | } 136 | } 137 | 138 | void CreateRunningOtherTaskActionDialog::loopToggled(bool state) 139 | { 140 | if(state) 141 | ui->spinBox_3->setEnabled(false); 142 | else 143 | ui->spinBox_3->setEnabled(true); 144 | } 145 | -------------------------------------------------------------------------------- /ui/Tasktab.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKTAB_H 2 | #define TASKTAB_H 3 | 4 | #include "Task.h" 5 | #include "ui/getdialogs/getDelayDialog.h" 6 | #include "ActionWidgetsManager.h" 7 | #include "ui/createactiondialogs/CreatePasteActionDialog.h" 8 | #include "ui/createactiondialogs/CreateWaitActionDialog.h" 9 | #include "ui/createactiondialogs/CreateKeysSequenceActionDialog.h" 10 | #include "ui/createactiondialogs/CreateSystemCommandActionDialog.h" 11 | #include "ui/createactiondialogs/CreateCursorMovementsActionDialog.h" 12 | #include "ui/createactiondialogs/CreateRunningOtherTaskActionDialog.h" 13 | #include "ui/CustomPrimaryWidgets.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | enum class ScheduleState{ 25 | NotScheduled, 26 | ScheduledInDelay, 27 | Running 28 | }; 29 | 30 | class TaskTab : public QScrollArea 31 | { 32 | Q_OBJECT 33 | protected: 34 | QString m_name; 35 | int m_ID; 36 | QString m_description = nullptr; 37 | QWidget *m_mainWidget = nullptr; 38 | QFrame *m_actionsFrame = nullptr; 39 | QVBoxLayout *m_actionsLayout = nullptr; 40 | std::shared_ptr m_task = nullptr; 41 | void buildBasicInterface(); 42 | void setTask(const std::shared_ptr & task); 43 | AbstractActionWidget *createActionWidget(const std::shared_ptr &act); 44 | QLabel *m_nameLabel = nullptr; 45 | QPlainTextEdit *m_descriptionEdit = nullptr; 46 | QPushButton *m_scheduleButton = nullptr; 47 | QPushButton *m_stopButton = nullptr; 48 | QToolButton *m_addActionButton = nullptr; 49 | QToolButton *m_loopButton = nullptr; 50 | QLabel *m_delayChrono = nullptr; 51 | void setName(const QString & newname); 52 | void setDescription(const QString & newdescription); 53 | getDelayDialog *m_getDelayDialog = nullptr; 54 | QDateTime m_datetimeOfRun; 55 | ActionWidgetsManager *m_actionWidgetsManager = nullptr; 56 | QTimer *m_scheduleTimer = nullptr; 57 | CreatePasteActionDialog *m_createPasteActionDialog = nullptr; 58 | CreateWaitActionDialog *m_createWaitActionDialog = nullptr; 59 | CreateSystemCommandActionDialog *m_createSystemCommandActionDialog = nullptr; 60 | CreateKeysSequenceActionDialog *m_createKeysSequenceActionDialog = nullptr; 61 | CreateCursorMovementsActionDialog *m_createCursorMovementsActionDialog = nullptr; 62 | CreateRunningOtherTaskActionDialog *m_createRunningOtherTaskActionDialog = nullptr; 63 | void buildAddButtonMenu(); 64 | void appendAction(const std::shared_ptr &act); 65 | unsigned int m_loopedTimes = 0; 66 | QLabel *m_loopedTimesLabel = nullptr; 67 | QPushButton *m_saveButton = nullptr; 68 | bool m_taskModifiedFromLastSave = false; 69 | QWidget *m_runOptionsWidget = nullptr; 70 | QWidget *m_timesToRunWidget = nullptr; 71 | NoWheelFocusSpinBox *m_timesToRunSpinBox = nullptr; 72 | void refreshTabRunIcon(); 73 | public: 74 | explicit TaskTab(QWidget *parent = nullptr, const QString & name = "NONAME"); 75 | ~TaskTab(); 76 | void runTaskThread(); 77 | ScheduleState m_scheduleState; 78 | void setTaskModified(bool val); 79 | bool taskIsModified() const {return m_taskModifiedFromLastSave;} 80 | void setTimesToRunValue(int timesToRun); 81 | private slots: 82 | void stopTask(); 83 | void forcedStop(); 84 | void loopToggled(bool state); 85 | void refreshScheduleText(); 86 | void anyActionChangedParam(); 87 | public slots: 88 | void scheduleTaskAfterDelay(qint64 delayInSeconds); 89 | void finishedOneLoop(); 90 | void receivedActionRunningState(unsigned int actId); 91 | void removeActionReceived(unsigned int actId); 92 | void moveToTopActionReceived(unsigned int actId); 93 | void moveToBottomActionReceived(unsigned int actId); 94 | void moveUpActionReceived(unsigned int actId); 95 | void moveDownActionReceived(unsigned int actId); 96 | void createPasteActionRequest(QString sentenceIdentity); // not const & because it's a slot, will make copy evenif 97 | void createWaitActionRequest(long double duration); // not const & because it's a slot, will make copy evenif 98 | void createKeysSequenceActionRequest(QString keysSequenceIdentity); // not const & because it's a slot, will make copy evenif 99 | void createSystemCommandActionRequest(QString sysCmdType, QString param1, QString param2); // not const & because it's a slot, will make copy evenif 100 | void createCursorMovementsActionRequest(QString cursorMovementsIdentity); // not const & because it's a slot, will make copy evenif 101 | void createRunningOtherTaskActionRequest(QString filename, int delay, int loops); // not const & because it's a slot, will make copy evenif 102 | signals: 103 | void saveTaskRequest(int taskId, bool verb); 104 | void forceStopThread(); 105 | 106 | friend class TaskTabsManager; 107 | }; 108 | 109 | #endif // TASKTAB_H 110 | -------------------------------------------------------------------------------- /globals.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBALS_H 2 | #define GLOBALS_H 3 | #include 4 | #include 5 | 6 | namespace G_Files { 7 | inline QString SettingsFilePath = "programSettings.ini"; 8 | inline QString DataFilePath = "programData.ini"; 9 | inline QString SentencesDataCategory = "sentences/"; 10 | inline QString KeysSequencesDataCategory = "keyssequences/"; 11 | inline QString CursorMovementsDataCategory = "cursormovements/"; 12 | inline QString DocumentIdentification_KeyWord = "docType"; 13 | inline QString DocumentIdentification_Value = "ScheduleTask File"; 14 | inline QString DocumentTaskDescription_KeyWord = "description"; 15 | inline QString DocumentActionsArray_KeyWord = "actions"; 16 | inline QString ActionType_KeyWord = "type"; 17 | inline QString ActionPasteType_Value = "paste"; 18 | inline QString ActionWaitType_Value = "wait"; 19 | inline QString ActionSystemCommandeType_Value = "systemcommand"; 20 | inline QString ActionKeysSequenceType_Value = "keyssequence"; 21 | inline QString ActionCursorMovementsType_Value = "cursormovements"; 22 | inline QString ActionRunningOtherTaskType_Value = "runningothertask"; 23 | inline QString ActionContent_KeyWord = "content"; 24 | inline QString ActionContentId_KeyWord = "contentId"; 25 | inline QString ActionPasteTextLoop_KeyWord = "loop"; 26 | inline QString ActionDuration_KeyWord = "duration"; 27 | inline QString ActionKeysSeqMap_KeyWord = "keysmap"; 28 | inline QString ActionKeysSeqId_KeyWord = "keysSeqId"; 29 | inline QString ActionKeysSeqLoop_KeyWord = "loop"; 30 | inline QString ActionSysCommandType_KeyWord = "sysCommandType"; 31 | inline QString ActionSysCommandParam1_KeyWord = "sysCommandParam1"; 32 | inline QString ActionSysCommandParam2_KeyWord = "sysCommandParam2"; 33 | inline QString ActionCursorMovsMap_KeyWord = "cursormovsmap"; 34 | inline QString ActionCursorMovsId_KeyWord = "cursorMovsId"; 35 | inline QString ActionCursorMovsLoop_KeyWord = "loop"; 36 | inline QString ActionCursorMovsOptKeysStroke_KeyWord = "optionalkeysstroke"; 37 | inline QString RunningOtherTaskFilename_KeyWord = "otherTaskName"; 38 | inline QString RunningOtherTaskDelay_KeyWord = "otherTaskDelay"; 39 | inline QString RunningOtherTaskLoops_KeyWord = "otherTaskLoops"; 40 | inline QString TasksFolder = "saved_tasks/"; 41 | inline QString TasksFileExtension = ".scht"; 42 | inline QString StartupTasksParams_KeyWord = "startupTasksParams"; 43 | inline QString SystemStartupRegistry_Path = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; 44 | inline QString ProgramNameInRegistry_KeyWord = "Tasket++"; 45 | } 46 | 47 | namespace G_Sentences { 48 | static QString AlreadyExists() {return QObject::tr("A task file with the chosen name already exists, do you confirm that you would like to overwrite this one ?");} 49 | static QString NoFileSelected() {return QObject::tr("No file has been selected from the table of saved files above. Please select one.");} 50 | static QString OperationInterference() {return QObject::tr("Some system or user action interferes with this operation, sorry for the inconvenience.");} 51 | static QString ForbiddenCharacter() {return QObject::tr("The filename contains some forbidden characters (<>:/\"|?*\\), please change it.");} 52 | static QString FileParsingError() {return QObject::tr("The file is not in the correct format for this software : parse error.");} 53 | static QString NoSetenceSelected() {return QObject::tr("No sentence has been selected. Please select one.");} 54 | static QString NoKeysSequenceSelected() {return QObject::tr("No keys sequence has been selected. Please select one.");} 55 | static QString NoCursorMovementsSelected() {return QObject::tr("No cursor movements set has been selected. Please select one.");} 56 | static QString NoStartupTaskSelected() {return QObject::tr("No startup task has been selected. Please select one.");} 57 | } 58 | 59 | namespace G_SystemCommands { 60 | inline QString UndefinedType = "undefined"; 61 | inline QString ShutDownType = "shutdown"; 62 | inline QString RestartType = "restart"; 63 | inline QString LogOffType = "logoff"; 64 | inline QString ChangeAudioVolumeType = "changevolume"; 65 | inline QString ChangeDefaultAudioDeviceType = "changeaudiodevice"; 66 | inline QString KillProcessType = "killprocess"; 67 | inline QString QuitSelfProgramType = "quitselfprogram"; 68 | inline QString CreateFolderType = "createfolder"; 69 | inline QString DeleteFolderType = "deletefolder"; 70 | inline QString CreateFileType = "createfile"; 71 | inline QString DeleteFileType = "deletefile"; 72 | inline QString TakeScreenshotType = "screenshot"; 73 | inline QString PrintActualScreenType = "printscreen"; 74 | inline QString OpenFileType = "openfile"; 75 | inline QString ExecuteProgramType = "executeprogram"; 76 | inline QString OpenUrlType = "openurl"; 77 | inline QString OpenFolderType = "openfolder"; 78 | inline QString CopyFileType = "copyfile"; 79 | } 80 | 81 | struct G_Parameters { 82 | static bool AutoScrollTask; 83 | }; 84 | 85 | #endif // GLOBALS_H 86 | -------------------------------------------------------------------------------- /ui/actionwidgets/PasteWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "PasteWidget.h" 2 | #include "actions/PasteAction.h" 3 | #include "globals.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | PasteWidget::PasteWidget(QWidget *parent) 12 | : AbstractActionWidget{parent} 13 | { 14 | 15 | } 16 | 17 | void PasteWidget::buildWidget() 18 | { 19 | if(m_centralWidget == nullptr) 20 | return; 21 | auto centralGridLayout = qobject_cast(m_centralWidget->layout()); 22 | if(centralGridLayout == nullptr) 23 | return; 24 | 25 | auto loopFrame = new QFrame(this); 26 | loopFrame->setObjectName("actionSubFrame"); 27 | auto loopLabel = new QLabel(tr("Loop "),this); 28 | loopLabel->setObjectName("actionSubLabel"); 29 | m_loopSpin = new NoWheelFocusSpinBox(this); 30 | m_loopSpin->setObjectName("actionSpin"); 31 | auto looptimesLabel = new QLabel(tr(" times"),this); 32 | looptimesLabel->setObjectName("actionSubLabel"); 33 | m_loopSpin->setAlignment(Qt::AlignCenter); 34 | m_loopSpin->setMinimum(1); 35 | m_loopSpin->setMaximum(9999); 36 | m_loopSpin->setMinimumWidth(60); 37 | m_loopSpin->setToolTip(tr("Set how many times this paste text should be executed")); 38 | 39 | auto loopLayout = new QHBoxLayout(loopFrame); 40 | loopLayout->addWidget(loopLabel,0,Qt::AlignVCenter | Qt::AlignRight); 41 | loopLayout->addWidget(m_loopSpin,0,Qt::AlignCenter); 42 | loopLayout->addWidget(looptimesLabel,0,Qt::AlignVCenter | Qt::AlignLeft); 43 | loopLayout->setContentsMargins(1,1,1,1); 44 | loopLayout->setSpacing(2); 45 | 46 | centralGridLayout->removeWidget(m_infoLabel); 47 | centralGridLayout->addWidget(loopFrame,1,0,Qt::AlignCenter); 48 | centralGridLayout->addWidget(m_infoLabel,2,0,Qt::AlignCenter); 49 | 50 | auto pasteaction = dynamic_cast(m_action.get()); 51 | 52 | QString content = tr("ERROR on access to action"); 53 | QString id = tr("ERROR"); 54 | if(pasteaction != nullptr) 55 | { 56 | content = pasteaction->m_content; 57 | id = pasteaction->m_contentId; 58 | m_loopSpin->setValue(pasteaction->m_timesToRun); 59 | } 60 | 61 | m_mainButton->setObjectName("pastetextActionButton"); 62 | m_mainButton->setText(tr("Paste text #")+id); 63 | m_mainButton->setToolTip(content); 64 | m_mainButton->setProperty("contentId", id); 65 | 66 | m_createPasteActionDialog = new CreatePasteActionDialog(m_centralWidget); 67 | 68 | connect(m_mainButton, &QPushButton::released, m_createPasteActionDialog, &CreatePasteActionDialog::showDialog); 69 | connect(m_createPasteActionDialog, &CreatePasteActionDialog::sendSentence, this, &PasteWidget::sentenceIdentityReceived); 70 | connect(m_loopSpin, &NoWheelFocusSpinBox::valueChanged, this, &PasteWidget::timesToRunChanged); 71 | } 72 | 73 | void PasteWidget::sentenceIdentityReceived(QString id) 74 | { 75 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 76 | QString content = settings.value(G_Files::SentencesDataCategory+id).toString(); 77 | 78 | auto pasteaction = dynamic_cast(m_action.get()); 79 | if(pasteaction == nullptr) 80 | { 81 | m_mainButton->setToolTip("ERROR on access to action"); 82 | m_mainButton->setText("Paste text #ERROR"); 83 | return; 84 | } 85 | pasteaction->m_content = content; 86 | pasteaction->m_contentId = id; 87 | m_mainButton->setText(tr("Paste text #")+id); 88 | m_mainButton->setToolTip(content); 89 | m_mainButton->setProperty("contentId", id); 90 | 91 | emit anyParamChanged(); 92 | } 93 | 94 | void PasteWidget::timesToRunChanged(int times) 95 | { 96 | auto pasteaction = dynamic_cast(m_action.get()); 97 | if(pasteaction == nullptr) 98 | return; 99 | pasteaction->m_timesToRun = times; 100 | emit anyParamChanged(); 101 | } 102 | 103 | void PasteWidget::changedRunningState() 104 | { 105 | refreshLoopsRemainingText(QDateTime::currentDateTime()); 106 | } 107 | 108 | void PasteWidget::refreshLoopsRemainingText(const QDateTime &departureDate) 109 | { 110 | m_infoLabel->setText(""); 111 | 112 | if(m_runningState == RunningState::NotExecuted || m_runningState == RunningState::Done) 113 | return; 114 | 115 | auto pasteaction = dynamic_cast(m_action.get()); 116 | if(pasteaction == nullptr) 117 | return; 118 | 119 | int oneExecutionDuration = pasteaction->computeOneExecutionDuration(); 120 | if(oneExecutionDuration == 0) 121 | return; 122 | 123 | qint64 timelaps = departureDate.msecsTo(QDateTime::currentDateTime()); 124 | int timesExecuted = timelaps / oneExecutionDuration; 125 | auto remainningTimes = pasteaction->m_timesToRun - timesExecuted; 126 | if(remainningTimes < 1) 127 | return; 128 | 129 | m_infoLabel->setText(tr("Remaining ")+QString::number(remainningTimes)+tr(" executions")); 130 | 131 | QTimer::singleShot(200, this, [=]() {refreshLoopsRemainingText(departureDate);}); 132 | 133 | } 134 | 135 | -------------------------------------------------------------------------------- /ui/tablewidgets/KeysSequencesTableWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "KeysSequencesTableWidget.h" 2 | #include "globals.h" 3 | #include "actions/ActionsTools.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | KeysSequencesTableWidget::KeysSequencesTableWidget(QWidget *parent) 10 | : NoFocusCellTableWidget{parent} 11 | { 12 | m_keysSequenceEditDialog = new KeysSequenceSelectedEditDialog(this); 13 | connect(m_keysSequenceEditDialog, &QDialog::accepted, this, &KeysSequencesTableWidget::editFromDialogReceived); 14 | connect(this, &QTableWidget::cellDoubleClicked, this, &KeysSequencesTableWidget::editKeysSequenceSelected); 15 | } 16 | 17 | void KeysSequencesTableWidget::createKeysSequenceReceived() 18 | { 19 | m_keysSequenceEditDialog->setEditable(true); 20 | m_keysSequenceEditDialog->setIdentity(""); 21 | m_keysSequenceEditDialog->setTableKeysSequence(PressedReleaseDelaysKeysMap()); 22 | m_keysSequenceEditDialog->exec(); 23 | } 24 | 25 | void KeysSequencesTableWidget::editKeysSequenceSelected(int row, int) 26 | { 27 | QTableWidgetItem *idItem = item(row,0); 28 | if(idItem == nullptr) 29 | return; 30 | 31 | QString trueId = idItem->text().remove(0,1); 32 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 33 | m_keysSequenceEditDialog->setEditable(m_belongsToDataEditDialog); 34 | m_keysSequenceEditDialog->setIdentity(trueId); 35 | auto readMap = settings.value(G_Files::KeysSequencesDataCategory + trueId).toMap(); 36 | m_keysSequenceEditDialog->setTableKeysSequence(ActionsTools::fromStandardQMapToKeysSeqMap(readMap)); 37 | m_keysSequenceEditDialog->show(); 38 | } 39 | 40 | void KeysSequencesTableWidget::editFromDialogReceived() 41 | { 42 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 43 | auto receivedMap = m_keysSequenceEditDialog->tableKeysSequence(); 44 | QMap writtenMap; 45 | for(auto [key,val] : receivedMap.asKeyValueRange()) 46 | { 47 | QVariant variant = QVariant::fromValue(val); 48 | writtenMap.insert(QString::number(key),variant); 49 | } 50 | settings.setValue(G_Files::KeysSequencesDataCategory+m_keysSequenceEditDialog->identity(), writtenMap); 51 | refresh(); 52 | 53 | selectKeysSequenceFromIdentity(m_keysSequenceEditDialog->identity()); 54 | } 55 | 56 | void KeysSequencesTableWidget::removeKeysSequenceReceived() 57 | { 58 | QItemSelectionModel *selection = selectionModel(); 59 | if(!selection->hasSelection()) 60 | { 61 | QMessageBox::warning(this, tr("No keys sequence selected"),G_Sentences::NoKeysSequenceSelected()); 62 | return; 63 | } 64 | 65 | if(QMessageBox::question(this, tr("Confirm removing keys sequence"), tr("You are about to remove this keys sequence from data stored, are you sure ?"), 66 | QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::Cancel), QMessageBox::StandardButton(QMessageBox::Cancel)) == QMessageBox::Cancel) 67 | return; 68 | 69 | int row = selection->selectedRows().at(0).row(); 70 | QTableWidgetItem *idItem = item(row,0); 71 | if(idItem == nullptr) 72 | return; 73 | QString trueId = idItem->text().remove(0,1); 74 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 75 | settings.remove(G_Files::KeysSequencesDataCategory + trueId); 76 | 77 | refresh(); 78 | } 79 | 80 | void KeysSequencesTableWidget::refresh() 81 | { 82 | clearContents(); 83 | setRowCount(0); 84 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 85 | QStringList keys = settings.allKeys(); 86 | for(const auto &key : keys) 87 | { 88 | if(key.startsWith(G_Files::KeysSequencesDataCategory)) 89 | { 90 | insertRow(rowCount()); 91 | 92 | QString id = key; 93 | id.remove(G_Files::KeysSequencesDataCategory); 94 | setItem(rowCount()-1,0,new QTableWidgetItem(">"+id)); 95 | 96 | QTableWidgetItem *contentItem = new QTableWidgetItem(); 97 | auto readMap = settings.value(G_Files::KeysSequencesDataCategory + id).toMap(); 98 | QStringList contentList; 99 | for(auto [key,val] : readMap.asKeyValueRange()) 100 | { 101 | ReleaseDelayKeysPair pair = val.value(); 102 | contentList.append(pair.second.join("+")); 103 | } 104 | QString fullContent = contentList.join(" ; "); 105 | contentItem->setText(fullContent); 106 | contentItem->setToolTip(ActionsTools::fromKeysSeqMapToPrintedString(ActionsTools::fromStandardQMapToKeysSeqMap(readMap))); 107 | setItem(rowCount()-1,1,contentItem); 108 | } 109 | } 110 | } 111 | 112 | void KeysSequencesTableWidget::selectKeysSequenceFromIdentity(const QString &id) 113 | { 114 | QTableWidgetItem *idItem = nullptr; 115 | int rowFound = -1; 116 | for(int k=0; k< rowCount(); ++k) 117 | { 118 | idItem = item(k,0); 119 | if(idItem != nullptr && idItem->text() == ">"+id) 120 | { 121 | rowFound = k; 122 | break; 123 | } 124 | } 125 | 126 | if(rowFound >= 0) 127 | { 128 | selectRow(rowFound); 129 | scrollToItem(idItem,QAbstractItemView::PositionAtCenter); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /ui/actionwidgets/KeysSequenceWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "KeysSequenceWidget.h" 2 | #include "actions/KeysSequenceAction.h" 3 | #include "globals.h" 4 | #include "actions/ActionsTools.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | KeysSequenceWidget::KeysSequenceWidget(QWidget *parent) 13 | : AbstractActionWidget{parent} 14 | { 15 | 16 | } 17 | 18 | void KeysSequenceWidget::buildWidget() 19 | { 20 | if(m_centralWidget == nullptr) 21 | return; 22 | auto centralGridLayout = qobject_cast(m_centralWidget->layout()); 23 | if(centralGridLayout == nullptr) 24 | return; 25 | 26 | auto loopFrame = new QFrame(this); 27 | loopFrame->setObjectName("actionSubFrame"); 28 | auto loopLabel = new QLabel(tr("Loop "),this); 29 | loopLabel->setObjectName("actionSubLabel"); 30 | m_loopSpin = new NoWheelFocusSpinBox(this); 31 | m_loopSpin->setObjectName("actionSpin"); 32 | auto looptimesLabel = new QLabel(tr(" times"),this); 33 | looptimesLabel->setObjectName("actionSubLabel"); 34 | m_loopSpin->setAlignment(Qt::AlignCenter); 35 | m_loopSpin->setMinimum(1); 36 | m_loopSpin->setMaximum(9999); 37 | m_loopSpin->setMinimumWidth(60); 38 | m_loopSpin->setToolTip(tr("Set how many times this keys sequence should be executed")); 39 | 40 | auto loopLayout = new QHBoxLayout(loopFrame); 41 | loopLayout->addWidget(loopLabel,0,Qt::AlignVCenter | Qt::AlignRight); 42 | loopLayout->addWidget(m_loopSpin,0,Qt::AlignCenter); 43 | loopLayout->addWidget(looptimesLabel,0,Qt::AlignVCenter | Qt::AlignLeft); 44 | loopLayout->setContentsMargins(1,1,1,1); 45 | loopLayout->setSpacing(2); 46 | 47 | centralGridLayout->removeWidget(m_infoLabel); 48 | centralGridLayout->addWidget(loopFrame,1,0,Qt::AlignCenter); 49 | centralGridLayout->addWidget(m_infoLabel,2,0,Qt::AlignCenter); 50 | 51 | auto keysseqaction = dynamic_cast(m_action.get()); 52 | 53 | QString seqStr = tr("ERROR on access to action"); 54 | QString id = tr("ERROR"); 55 | if(keysseqaction != nullptr) 56 | { 57 | id = keysseqaction->m_sequenceId; 58 | seqStr = ActionsTools::fromKeysSeqMapToPrintedString(keysseqaction->m_keysSeqMap); 59 | m_loopSpin->setValue(keysseqaction->m_timesToRun); 60 | } 61 | 62 | m_mainButton->setObjectName("keyActionButton"); 63 | m_mainButton->setText(tr("Keys sequence >")+id); 64 | m_mainButton->setToolTip(seqStr); 65 | m_mainButton->setProperty("keysSeqId", id); 66 | 67 | m_createKeysSeqActionDialog = new CreateKeysSequenceActionDialog(m_centralWidget); 68 | 69 | connect(m_mainButton, &QPushButton::released, m_createKeysSeqActionDialog, &CreateKeysSequenceActionDialog::showDialog); 70 | connect(m_createKeysSeqActionDialog, &CreateKeysSequenceActionDialog::sendKeysSequence, this, &KeysSequenceWidget::keysSeqIdentityReceived); 71 | connect(m_loopSpin, &NoWheelFocusSpinBox::valueChanged, this, &KeysSequenceWidget::timesToRunChanged); 72 | } 73 | 74 | void KeysSequenceWidget::keysSeqIdentityReceived(QString id) 75 | { 76 | auto keysseqaction = dynamic_cast(m_action.get()); 77 | if(keysseqaction == nullptr) 78 | { 79 | m_mainButton->setToolTip("ERROR on access to action"); 80 | m_mainButton->setText("Keys sequence >ERROR"); 81 | return; 82 | } 83 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 84 | auto keysSequenceFromSettings = settings.value(G_Files::KeysSequencesDataCategory+id).toMap(); 85 | PressedReleaseDelaysKeysMap keysMap = ActionsTools::fromStandardQMapToKeysSeqMap(keysSequenceFromSettings); 86 | keysseqaction->m_keysSeqMap = keysMap; 87 | keysseqaction->m_sequenceId = id; 88 | keysseqaction->generateTimeline(); 89 | m_mainButton->setText(tr("Keys sequence >")+id); 90 | m_mainButton->setToolTip(ActionsTools::fromKeysSeqMapToPrintedString(keysMap)); 91 | m_mainButton->setProperty("keysSeqId", id); 92 | 93 | emit anyParamChanged(); 94 | } 95 | 96 | void KeysSequenceWidget::timesToRunChanged(int times) 97 | { 98 | auto keysseqaction = dynamic_cast(m_action.get()); 99 | if(keysseqaction == nullptr) 100 | return; 101 | keysseqaction->m_timesToRun = times; 102 | emit anyParamChanged(); 103 | } 104 | 105 | void KeysSequenceWidget::changedRunningState() 106 | { 107 | refreshLoopsRemainingText(QDateTime::currentDateTime()); 108 | } 109 | 110 | void KeysSequenceWidget::refreshLoopsRemainingText(const QDateTime &departureDate) 111 | { 112 | m_infoLabel->setText(""); 113 | if(m_runningState == RunningState::NotExecuted || m_runningState == RunningState::Done) 114 | return; 115 | 116 | auto keysseqaction = dynamic_cast(m_action.get()); 117 | if(keysseqaction == nullptr) 118 | return; 119 | 120 | int oneExecutionDuration = keysseqaction->computeOneExecutionDuration(); 121 | if(oneExecutionDuration == 0) 122 | return; 123 | 124 | qint64 timelaps = departureDate.msecsTo(QDateTime::currentDateTime()); 125 | int timesExecuted = timelaps / oneExecutionDuration; 126 | auto remainningTimes = keysseqaction->m_timesToRun - timesExecuted; 127 | if(remainningTimes < 1) 128 | return; 129 | 130 | m_infoLabel->setText(tr("Remaining ")+QString::number(remainningTimes)+tr(" executions")); 131 | 132 | QTimer::singleShot(200, this, [=]() {refreshLoopsRemainingText(departureDate);}); 133 | } 134 | -------------------------------------------------------------------------------- /ui/actionwidgets/CursorMovementsWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "CursorMovementsWidget.h" 2 | #include "actions/CursorMovementsAction.h" 3 | #include "globals.h" 4 | #include "actions/ActionsTools.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | CursorMovementsWidget::CursorMovementsWidget(QWidget *parent) 13 | : AbstractActionWidget{parent} 14 | { 15 | 16 | } 17 | 18 | void CursorMovementsWidget::buildWidget() 19 | { 20 | if(m_centralWidget == nullptr) 21 | return; 22 | auto centralGridLayout = qobject_cast(m_centralWidget->layout()); 23 | if(centralGridLayout == nullptr) 24 | return; 25 | 26 | auto loopFrame = new QFrame(this); 27 | loopFrame->setObjectName("actionSubFrame"); 28 | auto loopLabel = new QLabel(tr("Loop "),this); 29 | loopLabel->setObjectName("actionSubLabel"); 30 | m_loopSpin = new NoWheelFocusSpinBox(this); 31 | m_loopSpin->setObjectName("actionSpin"); 32 | auto looptimesLabel = new QLabel(tr(" times"),this); 33 | looptimesLabel->setObjectName("actionSubLabel"); 34 | m_loopSpin->setAlignment(Qt::AlignCenter); 35 | m_loopSpin->setMinimum(1); 36 | m_loopSpin->setMaximum(9999); 37 | m_loopSpin->setMinimumWidth(60); 38 | m_loopSpin->setToolTip(tr("Set how many times this cursor movements should be executed")); 39 | 40 | auto loopLayout = new QHBoxLayout(loopFrame); 41 | loopLayout->addWidget(loopLabel,0,Qt::AlignVCenter | Qt::AlignRight); 42 | loopLayout->addWidget(m_loopSpin,0,Qt::AlignCenter); 43 | loopLayout->addWidget(looptimesLabel,0,Qt::AlignVCenter | Qt::AlignLeft); 44 | loopLayout->setContentsMargins(1,1,1,1); 45 | loopLayout->setSpacing(2); 46 | 47 | centralGridLayout->removeWidget(m_infoLabel); 48 | centralGridLayout->addWidget(loopFrame,1,0,Qt::AlignCenter); 49 | centralGridLayout->addWidget(m_infoLabel,2,0,Qt::AlignCenter); 50 | 51 | auto cursormovsaction = dynamic_cast(m_action.get()); 52 | 53 | QString movsStr = tr("ERROR on access to action"); 54 | QString id = tr("ERROR"); 55 | QStringList optKeysStroke; 56 | if(cursormovsaction != nullptr) 57 | { 58 | id = cursormovsaction->m_movementsId; 59 | movsStr = ActionsTools::fromCursorMovsMapToPrintedString(cursormovsaction->m_cursorMovementsList); 60 | optKeysStroke = cursormovsaction->m_cursorMovementsOptionalKeysStroke; 61 | m_loopSpin->setValue(cursormovsaction->m_timesToRun); 62 | } 63 | 64 | m_mainButton->setObjectName("cursorActionButton"); 65 | m_mainButton->setText(tr("Cursor movements ~")+id); 66 | m_mainButton->setToolTip(movsStr+"\nKeys stroke : "+optKeysStroke.join("+")); 67 | m_mainButton->setProperty("cursorMovsId", id); 68 | 69 | m_createCursorMovsActionDialog = new CreateCursorMovementsActionDialog(m_centralWidget); 70 | 71 | connect(m_mainButton, &QPushButton::released, m_createCursorMovsActionDialog, &CreateCursorMovementsActionDialog::showDialog); 72 | connect(m_createCursorMovsActionDialog, &CreateCursorMovementsActionDialog::sendCursorMovements, this, &CursorMovementsWidget::cursorMovsIdentityReceived); 73 | connect(m_loopSpin, &NoWheelFocusSpinBox::valueChanged, this, &CursorMovementsWidget::timesToRunChanged); 74 | 75 | } 76 | 77 | void CursorMovementsWidget::cursorMovsIdentityReceived(QString id) 78 | { 79 | auto cursormovsaction = dynamic_cast(m_action.get()); 80 | if(cursormovsaction == nullptr) 81 | { 82 | m_mainButton->setToolTip("ERROR on access to action"); 83 | m_mainButton->setText("Cursor movements ~ERROR"); 84 | return; 85 | } 86 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 87 | auto cursorMovementsFromSettings = settings.value(G_Files::CursorMovementsDataCategory+id).toList(); 88 | CursorMovementsList movsList = ActionsTools::fromStandardQMapToCursorMovsMap(cursorMovementsFromSettings); 89 | cursormovsaction->m_cursorMovementsList = movsList; 90 | cursormovsaction->m_movementsId = id; 91 | cursormovsaction->m_cursorMovementsOptionalKeysStroke = cursorMovementsFromSettings.last().toStringList(); 92 | m_mainButton->setText(tr("Cursor movements ~")+id); 93 | m_mainButton->setToolTip(ActionsTools::fromCursorMovsMapToPrintedString(movsList)+ 94 | "\nKeys stroke : "+cursorMovementsFromSettings.last().toStringList().join("+")); 95 | m_mainButton->setProperty("cursorMovsId", id); 96 | 97 | emit anyParamChanged(); 98 | } 99 | 100 | void CursorMovementsWidget::timesToRunChanged(int times) 101 | { 102 | auto cursormovsaction = dynamic_cast(m_action.get()); 103 | if(cursormovsaction == nullptr) 104 | return; 105 | cursormovsaction->m_timesToRun = times; 106 | emit anyParamChanged(); 107 | } 108 | 109 | void CursorMovementsWidget::changedRunningState() 110 | { 111 | refreshLoopsRemainingText(QDateTime::currentDateTime()); 112 | } 113 | 114 | void CursorMovementsWidget::refreshLoopsRemainingText(const QDateTime &departureDate) 115 | { 116 | m_infoLabel->setText(""); 117 | 118 | if(m_runningState == RunningState::NotExecuted || m_runningState == RunningState::Done) 119 | return; 120 | 121 | auto cursormovsaction = dynamic_cast(m_action.get()); 122 | if(cursormovsaction == nullptr) 123 | return; 124 | 125 | int oneExecutionDuration = cursormovsaction->computeOneExecutionDuration(); 126 | if(oneExecutionDuration == 0) 127 | return; 128 | 129 | qint64 timelaps = departureDate.msecsTo(QDateTime::currentDateTime()); 130 | int timesExecuted = timelaps / oneExecutionDuration; 131 | auto remainningTimes = cursormovsaction->m_timesToRun - timesExecuted; 132 | if(remainningTimes < 1) 133 | return; 134 | 135 | m_infoLabel->setText(tr("Remaining ")+QString::number(remainningTimes)+tr(" executions")); 136 | 137 | QTimer::singleShot(200, this, [=]() {refreshLoopsRemainingText(departureDate);}); 138 | 139 | } 140 | -------------------------------------------------------------------------------- /ui/tablewidgets/CursorMovementsTableWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "CursorMovementsTableWidget.h" 2 | #include "globals.h" 3 | #include "actions/ActionsTools.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | CursorMovementsTableWidget::CursorMovementsTableWidget(QWidget *parent):NoFocusCellTableWidget(parent) 10 | { 11 | m_cursorMovementsEditDialog = new CursorMovementsSelectedEditDialog(this); 12 | connect(m_cursorMovementsEditDialog, &QDialog::accepted, this, &CursorMovementsTableWidget::editFromDialogReceived); 13 | connect(this, &QTableWidget::cellDoubleClicked, this, &CursorMovementsTableWidget::editCursorMovementsSelected); 14 | } 15 | 16 | void CursorMovementsTableWidget::createCursorMovementsReceived() 17 | { 18 | m_cursorMovementsEditDialog->setEditable(true); 19 | m_cursorMovementsEditDialog->setIdentity(""); 20 | m_cursorMovementsEditDialog->setTableCursorMovements(CursorMovementsList()); 21 | m_cursorMovementsEditDialog->setOptionalKeysStroke(QStringList()); 22 | m_cursorMovementsEditDialog->exec(); 23 | } 24 | 25 | void CursorMovementsTableWidget::editFromDialogReceived() 26 | { 27 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 28 | auto receivedList = m_cursorMovementsEditDialog->tableCursorMovements(); 29 | QList writtenList; 30 | for(auto &el : receivedList) 31 | { 32 | QVariant variant = QVariant::fromValue(el); 33 | writtenList.append(variant); 34 | } 35 | writtenList.append(m_cursorMovementsEditDialog->optionalKeysStroke()); 36 | settings.setValue(G_Files::CursorMovementsDataCategory+m_cursorMovementsEditDialog->identity(),writtenList); 37 | refresh(); 38 | 39 | selectCursorMovementsFromIdentity(m_cursorMovementsEditDialog->identity()); 40 | } 41 | 42 | void CursorMovementsTableWidget::editCursorMovementsSelected(int row, int) 43 | { 44 | QTableWidgetItem *idItem = item(row,0); 45 | if(idItem == nullptr) 46 | return; 47 | 48 | QString trueId = idItem->text().remove(0,1); 49 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 50 | 51 | m_cursorMovementsEditDialog->setEditable(m_belongsToDataEditDialog); 52 | m_cursorMovementsEditDialog->setIdentity(trueId); 53 | auto readList = settings.value(G_Files::CursorMovementsDataCategory + trueId).toList(); 54 | m_cursorMovementsEditDialog->setTableCursorMovements(ActionsTools::fromStandardQMapToCursorMovsMap(readList)); 55 | m_cursorMovementsEditDialog->setOptionalKeysStroke(readList.last().toStringList()); 56 | m_cursorMovementsEditDialog->show(); 57 | } 58 | 59 | void CursorMovementsTableWidget::removeCursorMovementsReceived() 60 | { 61 | QItemSelectionModel *selection = selectionModel(); 62 | if(!selection->hasSelection()) 63 | { 64 | QMessageBox::warning(this, tr("No cursor movements set selected"),G_Sentences::NoCursorMovementsSelected()); 65 | return; 66 | } 67 | 68 | if(QMessageBox::question(this, tr("Confirm removing cursor movements set"), tr("You are about to remove this cursor movements set from data stored, are you sure ?"), 69 | QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::Cancel), QMessageBox::StandardButton(QMessageBox::Cancel)) == QMessageBox::Cancel) 70 | return; 71 | 72 | int row = selection->selectedRows().at(0).row(); 73 | QTableWidgetItem *idItem = item(row,0); 74 | if(idItem == nullptr) 75 | return; 76 | QString trueId = idItem->text().remove(0,1); 77 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 78 | settings.remove(G_Files::CursorMovementsDataCategory + trueId); 79 | 80 | refresh(); 81 | } 82 | 83 | void CursorMovementsTableWidget::refresh() 84 | { 85 | clearContents(); 86 | setRowCount(0); 87 | QSettings settings(QApplication::applicationDirPath()+"/"+G_Files::DataFilePath, QSettings::IniFormat); 88 | QStringList keys = settings.allKeys(); 89 | for(const auto &key : keys) 90 | { 91 | if(key.startsWith(G_Files::CursorMovementsDataCategory)) 92 | { 93 | insertRow(rowCount()); 94 | 95 | QString id = key; 96 | id.remove(G_Files::CursorMovementsDataCategory); 97 | setItem(rowCount()-1,0,new QTableWidgetItem("~"+id)); 98 | 99 | QTableWidgetItem *contentItem = new QTableWidgetItem(); 100 | auto readList = settings.value(G_Files::CursorMovementsDataCategory + id).toList(); 101 | QStringList contentList; 102 | for(auto &el : readList) 103 | { 104 | if(el==readList.last()) 105 | break; 106 | MovementList movelist = el.value(); 107 | if(movelist.size() >= 4) 108 | contentList.append("["+QString::number(movelist[2])+","+QString::number(movelist[3])+"]"); 109 | } 110 | QString fullContent = contentList.join(" ; ") + " (Keys stroke : "+readList.last().toStringList().join("+")+")"; 111 | contentItem->setText(fullContent); 112 | contentItem->setToolTip(ActionsTools::fromCursorMovsMapToPrintedString(ActionsTools::fromStandardQMapToCursorMovsMap(readList))+ 113 | "\nKeys stroke : "+readList.last().toStringList().join("+")); 114 | setItem(rowCount()-1,1,contentItem); 115 | } 116 | } 117 | } 118 | 119 | void CursorMovementsTableWidget::selectCursorMovementsFromIdentity(const QString &id) 120 | { 121 | QTableWidgetItem *idItem = nullptr; 122 | int rowFound = -1; 123 | for(int k=0; k< rowCount(); ++k) 124 | { 125 | idItem = item(k,0); 126 | if(idItem != nullptr && idItem->text() == "~"+id) 127 | { 128 | rowFound = k; 129 | break; 130 | } 131 | } 132 | 133 | if(rowFound >= 0) 134 | { 135 | selectRow(rowFound); 136 | scrollToItem(idItem,QAbstractItemView::PositionAtCenter); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /ui/actionwidgets/AbstractActionWidget.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractActionWidget.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | AbstractActionWidget::AbstractActionWidget(QWidget *parent) 8 | : QFrame{parent} 9 | { 10 | m_runningState = RunningState::NotExecuted; 11 | setProperty("runningState","notExecuted"); 12 | 13 | auto gridLayout = new QGridLayout(this); 14 | m_centralWidget = new QFrame(this); 15 | 16 | m_centralWidget->setMinimumHeight(90); 17 | m_centralWidget->setObjectName("actionSubFrame"); 18 | 19 | auto centralGridLayout = new QGridLayout(m_centralWidget); 20 | m_mainButton = new QPushButton(this); 21 | m_mainButton->setObjectName("actionButton"); 22 | m_mainButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 23 | m_mainButton->setMinimumWidth(200); 24 | 25 | m_infoLabel = new QLabel("",this); 26 | m_infoLabel->setObjectName("actionSubLabel"); 27 | m_infoLabel->setWordWrap(true); 28 | m_infoLabel->setAlignment(Qt::AlignCenter); 29 | m_infoLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 30 | m_infoLabel->setMinimumWidth(200); 31 | 32 | centralGridLayout->addWidget(m_mainButton,0,0,Qt::AlignCenter); 33 | centralGridLayout->addWidget(m_infoLabel,1,0,Qt::AlignCenter); 34 | 35 | centralGridLayout->setContentsMargins(1,1,1,1); 36 | centralGridLayout->setSpacing(2); 37 | centralGridLayout->setSizeConstraint(QLayout::SetMinimumSize); 38 | m_centralWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); 39 | 40 | m_removeButton = new QPushButton("",this); 41 | m_removeButton->setObjectName("deleteButton"); 42 | m_removeButton->setFlat(true); 43 | m_removeButton->setToolTip(tr("Remove this action from the task...")); 44 | m_moveToTopButton = new QPushButton("",this); 45 | m_moveToTopButton->setObjectName("movetopButton"); 46 | m_moveToTopButton->setFlat(true); 47 | m_moveToTopButton->setToolTip(tr("Move this action to the top")); 48 | m_moveToBottomButton = new QPushButton("",this); 49 | m_moveToBottomButton->setObjectName("movebottomButton"); 50 | m_moveToBottomButton->setFlat(true); 51 | m_moveToBottomButton->setToolTip(tr("Move this action to the bottom")); 52 | m_moveUpButton = new QPushButton("",this); 53 | m_moveUpButton->setObjectName("moveupButton"); 54 | m_moveUpButton->setFlat(true); 55 | m_moveUpButton->setToolTip(tr("Move this action up")); 56 | m_moveDownButton = new QPushButton("",this); 57 | m_moveDownButton->setObjectName("movedownButton"); 58 | m_moveDownButton->setFlat(true); 59 | m_moveDownButton->setToolTip(tr("Move this action down")); 60 | 61 | QGridLayout *rightLayout = new QGridLayout(); 62 | rightLayout->addWidget(m_moveUpButton,0,0); 63 | rightLayout->addWidget(m_moveDownButton,1,0); 64 | rightLayout->addWidget(m_moveToTopButton,0,1); 65 | rightLayout->addWidget(m_moveToBottomButton,1,1); 66 | rightLayout->addWidget(m_removeButton,0,2); 67 | rightLayout->setContentsMargins(1,1,1,1); 68 | rightLayout->setSpacing(2); 69 | rightLayout->setSizeConstraint(QLayout::SetMinimumSize); 70 | 71 | gridLayout->addItem(new QSpacerItem(3,3,QSizePolicy::Fixed,QSizePolicy::Fixed),0,0); 72 | gridLayout->addWidget(m_centralWidget,1,1,Qt::AlignCenter); 73 | gridLayout->addItem(new QSpacerItem(5,5,QSizePolicy::Fixed,QSizePolicy::Fixed),1,2); 74 | gridLayout->addLayout(rightLayout,1,3,Qt::AlignRight | Qt::AlignTop); 75 | gridLayout->addItem(new QSpacerItem(3,3,QSizePolicy::Fixed,QSizePolicy::Fixed),2,2); 76 | gridLayout->setContentsMargins(1,1,1,1); 77 | gridLayout->setSpacing(2); 78 | gridLayout->setColumnStretch(1,1); 79 | setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 80 | gridLayout->setSizeConstraint(QLayout::SetMinimumSize); 81 | 82 | connect(m_removeButton,&QPushButton::released, this, &AbstractActionWidget::removeSelf); 83 | connect(m_moveToTopButton,&QPushButton::released, this, &AbstractActionWidget::moveToTopSelf); 84 | connect(m_moveToBottomButton,&QPushButton::released, this, &AbstractActionWidget::moveToBottomSelf); 85 | connect(m_moveUpButton,&QPushButton::released, this, &AbstractActionWidget::moveUpSelf); 86 | connect(m_moveDownButton,&QPushButton::released, this, &AbstractActionWidget::moveDownSelf); 87 | } 88 | 89 | AbstractActionWidget::~AbstractActionWidget() 90 | { 91 | layout()->deleteLater(); 92 | } 93 | 94 | void AbstractActionWidget::setRunningState(RunningState state) 95 | { 96 | m_runningState = state; 97 | 98 | if(m_runningState == RunningState::NotExecuted) 99 | setProperty("runningState","notExecuted"); 100 | else if(m_runningState == RunningState::Running) 101 | setProperty("runningState","running"); 102 | else 103 | setProperty("runningState","done"); 104 | 105 | style()->unpolish(this); 106 | style()->polish(this); 107 | m_centralWidget->style()->unpolish(m_centralWidget); 108 | m_centralWidget->style()->polish(m_centralWidget); 109 | 110 | changedRunningState(); 111 | } 112 | 113 | void AbstractActionWidget::setAction(const std::shared_ptr &action) 114 | { 115 | m_action = action; 116 | if(action != nullptr) 117 | m_actionID = action->getID(); 118 | } 119 | 120 | void AbstractActionWidget::removeSelf() 121 | { 122 | if(QMessageBox::question(this, tr("Confirm removing action"), tr("You are about to remove this action from the task, are you sure ?"), 123 | QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::Cancel), QMessageBox::StandardButton(QMessageBox::Cancel)) == QMessageBox::Cancel) 124 | return; 125 | 126 | emit removeActionRequest(m_actionID); 127 | } 128 | 129 | void AbstractActionWidget::moveToTopSelf() 130 | { 131 | emit moveToTopActionRequest(m_actionID); 132 | } 133 | 134 | void AbstractActionWidget::moveToBottomSelf() 135 | { 136 | emit moveToBottomActionRequest(m_actionID); 137 | } 138 | 139 | void AbstractActionWidget::moveUpSelf() 140 | { 141 | emit moveUpActionRequest(m_actionID); 142 | } 143 | 144 | void AbstractActionWidget::moveDownSelf() 145 | { 146 | emit moveDownActionRequest(m_actionID); 147 | } 148 | -------------------------------------------------------------------------------- /ui/editselectedactiondialogs/SentenceSelectedEditDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SentenceSelectedEditDialog 4 | 5 | 6 | Qt::WindowModality::WindowModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 650 13 | 395 14 | 15 | 16 | 17 | Create/Edit/View a sentences 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 1 25 | 26 | 27 | 1 28 | 29 | 30 | 1 31 | 32 | 33 | 1 34 | 35 | 36 | 2 37 | 38 | 39 | 40 | 41 | Qt::Orientation::Vertical 42 | 43 | 44 | QSizePolicy::Policy::Preferred 45 | 46 | 47 | 48 | 10 49 | 10 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Qt::Orientation::Vertical 61 | 62 | 63 | QSizePolicy::Policy::Preferred 64 | 65 | 66 | 67 | 20 68 | 20 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Qt::Orientation::Vertical 77 | 78 | 79 | QSizePolicy::Policy::Preferred 80 | 81 | 82 | 83 | 10 84 | 10 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | Content : 93 | 94 | 95 | 96 | 97 | 98 | 99 | Identity must be alphanumerical 100 | 101 | 102 | Qt::AlignmentFlag::AlignCenter 103 | 104 | 105 | 106 | 107 | 108 | 109 | Qt::Orientation::Horizontal 110 | 111 | 112 | QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Save 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 2 121 | 122 | 123 | 1 124 | 125 | 126 | 1 127 | 128 | 129 | 1 130 | 131 | 132 | 1 133 | 134 | 135 | 136 | 137 | Qt::Orientation::Horizontal 138 | 139 | 140 | 141 | 40 142 | 20 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | Sentence's identity 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 250 159 | 0 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | Qt::Orientation::Horizontal 168 | 169 | 170 | 171 | 40 172 | 20 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | buttonBox 186 | accepted() 187 | SentenceSelectedEditDialog 188 | accept() 189 | 190 | 191 | 248 192 | 254 193 | 194 | 195 | 157 196 | 274 197 | 198 | 199 | 200 | 201 | buttonBox 202 | rejected() 203 | SentenceSelectedEditDialog 204 | reject() 205 | 206 | 207 | 316 208 | 260 209 | 210 | 211 | 286 212 | 274 213 | 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /ScheduledPasteAndKeys.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | CONFIG += c++17 6 | 7 | TARGET = Tasket++ 8 | 9 | QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function -Wno-unused-parameter -Wno-unused-result 10 | 11 | SOURCES += \ 12 | ActionWidgetsManager.cpp \ 13 | Task.cpp \ 14 | TaskTabsManager.cpp \ 15 | TaskThread.cpp \ 16 | actions/AbstractAction.cpp \ 17 | actions/ActionsTools.cpp \ 18 | actions/CursorMovementsAction.cpp \ 19 | actions/KeysSequenceAction.cpp \ 20 | actions/PasteAction.cpp \ 21 | actions/RunningOtherTaskAction.cpp \ 22 | actions/SystemCommandsAction.cpp \ 23 | actions/WaitAction.cpp \ 24 | main.cpp \ 25 | mainwindow.cpp \ 26 | ui/actionwidgets/RunningOtherTaskWidget.cpp \ 27 | ui/createactiondialogs/CreateRunningOtherTaskActionDialog.cpp \ 28 | ui/various_dialogs/CreateAutorunDesktopShortcutDialog.cpp \ 29 | ui/various_dialogs/CreateLoadTaskDialog.cpp \ 30 | ui/editselectedactiondialogs/CursorMovementsSelectedEditDialog.cpp \ 31 | ui/tablewidgets/CursorMovementsTableWidget.cpp \ 32 | ui/various_dialogs/DataEditDialog.cpp \ 33 | ui/various_dialogs/KeysSelectorDialog.cpp \ 34 | ui/editselectedactiondialogs/KeysSequenceSelectedEditDialog.cpp \ 35 | ui/tablewidgets/KeysSequencesTableWidget.cpp \ 36 | ui/editselectedactiondialogs/SentenceSelectedEditDialog.cpp \ 37 | ui/tablewidgets/SentencesTableWidget.cpp \ 38 | ui/various_dialogs/StartupTaskEditDialog.cpp \ 39 | ui/various_dialogs/StartupTasksDialog.cpp \ 40 | ui/tablewidgets/StartupTasksTableWidget.cpp \ 41 | ui/TaskTab.cpp \ 42 | ui/actionwidgets/AbstractActionWidget.cpp \ 43 | ui/actionwidgets/CursorMovementsWidget.cpp \ 44 | ui/actionwidgets/KeysSequenceWidget.cpp \ 45 | ui/actionwidgets/PasteWidget.cpp \ 46 | ui/actionwidgets/SystemCommandWidget.cpp \ 47 | ui/actionwidgets/WaitWidget.cpp \ 48 | ui/createactiondialogs/CreateCursorMovementsActionDialog.cpp \ 49 | ui/createactiondialogs/CreateKeysSequenceActionDialog.cpp \ 50 | ui/createactiondialogs/CreatePasteActionDialog.cpp \ 51 | ui/createactiondialogs/CreateSystemCommandActionDialog.cpp \ 52 | ui/createactiondialogs/CreateWaitActionDialog.cpp \ 53 | ui/getdialogs/getAutoRenameOptionDialog.cpp \ 54 | ui/getdialogs/getCursorCoordinatesWidget.cpp \ 55 | ui/getdialogs/getDelayDialog.cpp \ 56 | ui/getdialogs/getFilePathDialog.cpp \ 57 | ui/getdialogs/getFolderPathDialog.cpp \ 58 | ui/getdialogs/getImagePathDialog.cpp \ 59 | ui/getdialogs/getProgramPathDialog.cpp 60 | 61 | HEADERS += \ 62 | ActionWidgetsManager.h \ 63 | Task.h \ 64 | TaskTabsManager.h \ 65 | TaskThread.h \ 66 | actions/AbstractAction.h \ 67 | actions/ActionParameters.h \ 68 | actions/ActionsTools.h \ 69 | actions/CursorMovementsAction.h \ 70 | actions/KeysSequenceAction.h \ 71 | actions/PasteAction.h \ 72 | actions/RunningOtherTaskAction.h \ 73 | actions/SystemCommandsAction.h \ 74 | actions/WaitAction.h \ 75 | globals.h \ 76 | mainwindow.h \ 77 | ui/actionwidgets/RunningOtherTaskWidget.h \ 78 | ui/createactiondialogs/CreateRunningOtherTaskActionDialog.h \ 79 | ui/various_dialogs/CreateAutorunDesktopShortcutDialog.h \ 80 | ui/various_dialogs/CreateLoadTaskDialog.h \ 81 | ui/editselectedactiondialogs/CursorMovementsSelectedEditDialog.h \ 82 | ui/tablewidgets/CursorMovementsTableWidget.h \ 83 | ui/CustomPrimaryWidgets.h \ 84 | ui/various_dialogs/DataEditDialog.h \ 85 | ui/various_dialogs/KeysSelectorDialog.h \ 86 | ui/editselectedactiondialogs/KeysSequenceSelectedEditDialog.h \ 87 | ui/tablewidgets/KeysSequencesTableWidget.h \ 88 | ui/editselectedactiondialogs/SentenceSelectedEditDialog.h \ 89 | ui/tablewidgets/SentencesTableWidget.h \ 90 | ui/various_dialogs/StartupTaskEditDialog.h \ 91 | ui/various_dialogs/StartupTasksDialog.h \ 92 | ui/tablewidgets/StartupTasksTableWidget.h \ 93 | ui/TaskTab.h \ 94 | ui/actionwidgets/AbstractActionWidget.h \ 95 | ui/actionwidgets/CursorMovementsWidget.h \ 96 | ui/actionwidgets/KeysSequenceWidget.h \ 97 | ui/actionwidgets/PasteWidget.h \ 98 | ui/actionwidgets/SystemCommandWidget.h \ 99 | ui/actionwidgets/WaitWidget.h \ 100 | ui/createactiondialogs/CreateCursorMovementsActionDialog.h \ 101 | ui/createactiondialogs/CreateKeysSequenceActionDialog.h \ 102 | ui/createactiondialogs/CreatePasteActionDialog.h \ 103 | ui/createactiondialogs/CreateSystemCommandActionDialog.h \ 104 | ui/createactiondialogs/CreateWaitActionDialog.h \ 105 | ui/getdialogs/getAutoRenameOptionDialog.h \ 106 | ui/getdialogs/getCursorCoordinatesWidget.h \ 107 | ui/getdialogs/getDelayDialog.h \ 108 | ui/getdialogs/getFilePathDialog.h \ 109 | ui/getdialogs/getFolderPathDialog.h \ 110 | ui/getdialogs/getImagePathDialog.h \ 111 | ui/getdialogs/getProgramPathDialog.h 112 | 113 | FORMS += \ 114 | mainwindow.ui \ 115 | ui/createactiondialogs/CreateRunningOtherTaskActionDialog.ui \ 116 | ui/various_dialogs/CreateAutorunDesktopShortcutDialog.ui \ 117 | ui/various_dialogs/CreateLoadTaskDialog.ui \ 118 | ui/editselectedactiondialogs/CursorMovementsSelectedEditDialog.ui \ 119 | ui/various_dialogs/DataEditDialog.ui \ 120 | ui/various_dialogs/KeysSelectorDialog.ui \ 121 | ui/editselectedactiondialogs/KeysSequenceSelectedEditDialog.ui \ 122 | ui/editselectedactiondialogs/SentenceSelectedEditDialog.ui \ 123 | ui/various_dialogs/StartupTaskEditDialog.ui \ 124 | ui/various_dialogs/StartupTasksDialog.ui \ 125 | ui/createactiondialogs/CreateCursorMovementsActionDialog.ui \ 126 | ui/createactiondialogs/CreateKeysSequenceActionDialog.ui \ 127 | ui/createactiondialogs/CreatePasteActionDialog.ui \ 128 | ui/createactiondialogs/CreateSystemCommandActionDialog.ui \ 129 | ui/createactiondialogs/CreateWaitActionDialog.ui \ 130 | ui/getdialogs/getAutoRenameOptionDialog.ui \ 131 | ui/getdialogs/getDelayDialog.ui \ 132 | ui/getdialogs/getFilePathDialog.ui \ 133 | ui/getdialogs/getFolderPathDialog.ui \ 134 | ui/getdialogs/getImagePathDialog.ui \ 135 | ui/getdialogs/getProgramPathDialog.ui 136 | 137 | LIBS += -luser32 -lole32 -luuid 138 | 139 | TRANSLATIONS = ScheduledPCTasks_fr.ts 140 | 141 | RESOURCES += \ 142 | resources.qrc 143 | 144 | RC_ICONS = img/programIcon.ico 145 | 146 | VERSION = 1.6 147 | QMAKE_TARGET_COMPANY = "Amir Hammoutene" 148 | QMAKE_TARGET_COPYRIGHT = "GNU general public license version 3" 149 | 150 | DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\" \ 151 | APP_COMPANY=\"\\\"$${QMAKE_TARGET_COMPANY}\\\"\" \ 152 | APP_COPYRIGHT=\"\\\"$${QMAKE_TARGET_COPYRIGHT}\\\"\" 153 | --------------------------------------------------------------------------------