summaryrefslogtreecommitdiff
path: root/OptionDialog.h
blob: 2055c4c40998b1083bfb83e1d7fa2533fecbf797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/** \file OptionDialog.h
\brief To have an interface to control the options
\author alpha_one_x86
\licence GPL3, see the file COPYING */

#include "Environment.h"

#ifndef OPTIONDIALOG_H
#define OPTIONDIALOG_H

#include <QDialog>
#include <QAbstractButton>
#include <QTreeWidgetItem>

#ifdef ULTRACOPIER_CGMINER
#define ULTRACOPIER_CGMINER_WORKING_COUNT 10
#include <QProcess>
#include <QTime>
#endif

#include "Environment.h"
#include "OSSpecific.h"
#include "PluginsManager.h"

namespace Ui {
    class OptionDialog;
}

/** \brief Dialog for the options

  It's need manage the ultracopier options, plugins selection, plugin prority.
  It's need manage too the plugin options and plugins informations.
  */
class OptionDialog : public QDialog
{
    Q_OBJECT
public:
    explicit OptionDialog();
    ~OptionDialog();
    /** \brief add the option widget from copy engine */
    void addPluginOptionWidget(const PluginType &category,const QString &name,QWidget * options);
protected:
    void changeEvent(QEvent *e);
    void loadLogVariableLabel();
private slots:
    void on_treeWidget_itemSelectionChanged();
    void on_buttonBox_clicked(QAbstractButton *button);
    //plugin management
    void onePluginAdded(const PluginsAvailable &plugin);
    #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
    void onePluginWillBeRemoved(const PluginsAvailable &plugin);
    #endif
    #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
    void manuallyAdded(const PluginsAvailable &plugin);
    #endif
    void loadOption();
    void newOptionValue(const QString &group,const QString &name,const QVariant &value);
    void on_Ultracopier_current_theme_currentIndexChanged(const int &index);
    void on_Language_currentIndexChanged(const int &index);
    void on_Language_force_toggled(const bool &checked);
    void on_CatchCopyAsDefault_toggled(const bool &checked);
    #ifdef ULTRACOPIER_CGMINER
    void error( QProcess::ProcessError error );
    void finished( int exitCode, QProcess::ExitStatus exitStatus );
    void readyReadStandardError();
    void readyReadStandardOutput();
    void startAddon();
    //void checkWorking();
    void checkIdle();
    //int getcpuload();
    #endif
    #ifndef ULTRACOPIER_VERSION_PORTABLE
    void on_LoadAtSessionStarting_toggled(const bool &checked);
    #endif
    void on_CopyEngineList_itemSelectionChanged();
    void on_toolButtonDown_clicked();
    void on_toolButtonUp_clicked();
    void on_pluginList_itemSelectionChanged();
    #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
    void on_pluginRemove_clicked();
    void on_pluginAdd_clicked();
    #endif
    void on_pluginInformation_clicked();
    void on_checkBox_Log_clicked();
    void on_lineEditLog_File_editingFinished();
    void on_lineEditLog_transfer_format_editingFinished();
    void on_lineEditLog_error_format_editingFinished();
    void on_checkBoxLog_transfer_clicked();
    void on_checkBoxLog_error_clicked();
    void on_logBrowse_clicked();
    void on_checkBoxLog_folder_clicked();
    void on_checkBoxLog_sync_clicked();
    void on_ActionOnManualOpen_currentIndexChanged(const int &index);
    void on_GroupWindowWhen_currentIndexChanged(const int &index);
    void on_DisplayOSWarning_clicked();
    void on_checkTheUpdate_clicked();
    void on_confirmToGroupWindows_clicked();
    void on_giveGPUTime_clicked();
    void oSSpecificClosed();
    void on_remainingTimeAlgorithm_currentIndexChanged(int index);

private:
    bool quit;
    Ui::OptionDialog *ui;
    struct pluginStore
    {
        QTreeWidgetItem * item;
        QString path;
        bool isWritable;
    };
    QList<pluginStore> pluginLink;
    struct pluginOptionsWidget
    {
        QString name;
        QTreeWidgetItem * item;
        QWidget *options;
        PluginType category;
    };
    QList<pluginOptionsWidget> pluginOptionsWidgetList;
    int number_of_listener;
    void addLanguage(const PluginsAvailable &plugin);
    void removeLanguage(const PluginsAvailable &plugin);
    void addTheme(const PluginsAvailable &plugin);
    void removeTheme(const PluginsAvailable &plugin);
    QStringList copyEngineStringList() const;
    bool ignoreCopyEngineListEdition;
    PluginsManager::ImportBackend defaultImportBackend;
    int index,loop_size;
    int loadedCopyEnginePlugin;
    QTreeWidgetItem * treeWidgetItem;
    OSSpecific *oSSpecific;
    bool allPluginsIsLoaded;
    #ifdef ULTRACOPIER_CGMINER
    #if defined(_M_X64)//ethminer
    QString addonMode;
    #endif
    QProcess addon;
    bool OpenCLDll;
    bool haveAddon;
    QList<QStringList> pools;
    QTimer restartaddon;
    QTimer autorestartaddon;
    QTimer checkIdleTimer,checkWorkingTimer;
    quint32 dwTimeIdle;
    QTime dwTimeIdleTime;
    bool isIdle;
    int workingCount;
    #endif
public slots:
    void newThemeOptions(const QString &name,QWidget* theNewOptionsWidget,bool isLoaded,bool havePlugin);
    void newClientList(const QStringList &clientsList);
signals:
    void previouslyPluginAdded(const PluginsAvailable &plugin) const;
};

#endif // OPTIONDIALOG_H