optionsWidget.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef OPTIONSWIDGET_HH
00047 #define OPTIONSWIDGET_HH
00048
00049 #include "ui_optionsWidget.hh"
00050 #include <QtGui>
00051 #include <QStringList>
00052 #include <QtNetwork>
00053
00054 #include <OpenFlipper/Core/PluginInfo.hh>
00055
00056
00057 typedef std::multimap< std::pair< QObject*, int >, std::pair< int, Qt::KeyboardModifiers > > InverseKeyMap;
00058
00059
00060 class OptionsWidget : public QWidget, public Ui::OptionsWidget
00061 {
00062
00063 Q_OBJECT
00064
00065 public:
00066 OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, InverseKeyMap& _invKeys, QWidget* parent =0 );
00067
00068 signals:
00069 void applyOptions();
00070 void saveOptions();
00071
00072 void addKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject* _plugin, int _keyBindingID);
00073
00074 private slots:
00076 void slotOk();
00078 void slotApply();
00079
00081 void slotCancel();
00082
00084 void slotCheckUpdates();
00085
00087 void slotGetUpdates();
00088
00090 void getBackgroundColor();
00091 void getBaseColor();
00092
00094 void keyTreeItemChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );
00095
00096 void keyTreeDoubleClicked(QTreeWidgetItem* _item, int col);
00097
00098 void updateShortcut();
00099
00100 void slotShowPluginOptions(const QString& _pluginName );
00101
00103 void restoreKeyPresets();
00104
00106 void updateViewerSettings(int _row);
00107
00109 void viewerSettingsChanged(QListWidgetItem* _item);
00110 void viewerSettingsChanged(int _index);
00111
00112 protected:
00113 void showEvent ( QShowEvent * event );
00114
00115 private:
00116
00117
00118 void initPluginOptions();
00119
00120 QVBoxLayout* pluginOptionsLayout;
00121
00122
00123 std::vector<PluginInfo>& plugins_;
00124 std::vector<KeyBinding>& coreKeys_;
00125
00126 InverseKeyMap& keys_;
00127
00128 int getPluginInfo(QString pluginName);
00129
00130 void initKeyTree();
00131
00132 void applyShortcuts();
00133
00134
00135 bool httpRequestAborted;
00136
00137
00138 int httpGetId;
00139
00140
00141 QHttp *http;
00142
00143
00144 QFile *file;
00145
00146
00147 QProgressDialog *progressDialog;
00148
00149
00150 enum DOWNLOAD {
00151 NONE,
00152 VERSIONS_FILE,
00153 PLUGIN,
00154 WINDOWS_SETUP
00155 } downloadType;
00156
00157
00158 std::vector< uint > defaultDrawModes_;
00159 std::vector< int > defaultProjectionMode_;
00160 std::vector< int > defaultViewingDirections_;
00161
00162 bool updatingViewerSettings_;
00163
00164 private:
00166 void startDownload( QString _url );
00167
00169 void compareVersions();
00170
00172 bool isNewer(QString _current, QString _latest);
00173
00175 void updateVersionsTable();
00176
00177 private slots:
00178
00179
00180 void httpRequestFinished(int requestId, bool error);
00181
00182
00183 void readResponseHeader(const QHttpResponseHeader &responseHeader);
00184
00185
00186 void updateDataReadProgress(int bytesRead, int totalBytes);
00187
00188
00189 void cancelDownload();
00190
00191
00192 void updateComponent();
00193
00194 private:
00197 QStringList updatedPlugins_;
00198
00201 QString pluginPath_;
00202
00205 QString currentUpdateName_;
00206
00207
00208 };
00209
00210 #endif //OPTIONSWIDGET_HH