ScreenTranslator/Manager.h

68 lines
1.5 KiB
C
Raw Normal View History

2013-11-23 13:48:34 +07:00
#ifndef MANAGER_H
#define MANAGER_H
#include <QPixmap>
2013-11-24 20:06:19 +07:00
#include <QSystemTrayIcon>
#include <QMap>
2013-11-23 13:48:34 +07:00
2013-11-26 13:44:00 +07:00
#include "ProcessingItem.h"
2013-11-24 19:43:37 +07:00
class QAction;
2013-11-23 13:48:34 +07:00
class QMenu;
class SelectionDialog;
2013-11-26 13:44:00 +07:00
class ResultDialog;
2014-04-04 21:39:10 +07:00
class LanguageHelper;
2013-11-23 13:48:34 +07:00
2015-09-23 01:41:08 +07:00
class Manager : public QObject {
Q_OBJECT
2013-11-23 13:48:34 +07:00
public:
2015-09-23 01:41:08 +07:00
explicit Manager (QObject *parent = 0);
2013-11-23 13:48:34 +07:00
~Manager ();
signals:
void requestRecognize (ProcessingItem item);
void recognized (ProcessingItem item);
void requestTranslate (ProcessingItem item);
void closeSelections ();
2013-11-24 19:43:37 +07:00
void settingsEdited ();
2013-11-23 13:48:34 +07:00
private slots:
void capture ();
void repeatCapture ();
2013-11-23 13:48:34 +07:00
void settings ();
void close ();
2013-11-24 20:06:19 +07:00
void about ();
void showLast ();
void copyLastToClipboard ();
2013-11-23 13:48:34 +07:00
2013-11-24 19:43:37 +07:00
void applySettings ();
2013-11-24 20:06:19 +07:00
void processTrayAction (QSystemTrayIcon::ActivationReason reason);
void handleSelection (ProcessingItem item);
2013-11-26 13:44:00 +07:00
void showResult (ProcessingItem item);
2013-11-24 19:43:37 +07:00
void showError (QString text);
2013-11-23 13:48:34 +07:00
private:
2015-09-23 01:41:08 +07:00
QMenu * trayContextMenu ();
void updateActionsState (bool isEnabled = true);
2013-11-23 13:48:34 +07:00
private:
2015-09-23 01:41:08 +07:00
QSystemTrayIcon *trayIcon_;
LanguageHelper *dictionary_;
//! Selection dialogs for each screen. Key - screen name.
QMap<QString, SelectionDialog *> selections_;
2015-09-23 01:41:08 +07:00
ResultDialog *resultDialog_;
QAction *captureAction_;
QAction *repeatCaptureAction_;
2015-09-23 01:41:08 +07:00
QAction *repeatAction_;
QAction *clipboardAction_;
bool useResultDialog_;
2015-09-29 02:17:24 +07:00
//! Used threads. For proper termination.
QList<QThread *> threads_;
2013-11-23 13:48:34 +07:00
};
#endif // MANAGER_H