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 #include <ACG/Scenegraph/DrawModes.hh>
00056
00057
00058 typedef std::multimap< std::pair< QObject*, int >, std::pair< int, Qt::KeyboardModifiers > > InverseKeyMap;
00059
00060
00061 class OptionsWidget : public QWidget, public Ui::OptionsWidget
00062 {
00063
00064 Q_OBJECT
00065
00066 public:
00067 OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, InverseKeyMap& _invKeys, QWidget* parent =0 );
00068
00069 signals:
00070 void applyOptions();
00071 void saveOptions();
00072
00073 void addKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject* _plugin, int _keyBindingID);
00074
00075 private slots:
00077 void slotOk();
00079 void slotApply();
00080
00082 void slotCancel();
00083
00085 void slotCheckUpdates();
00086
00088 void slotGetUpdates();
00089
00091 void getBackgroundColor();
00092 void getBaseColor();
00093
00095 void keyTreeItemChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );
00096
00097 void keyTreeDoubleClicked(QTreeWidgetItem* _item, int col);
00098
00099 void updateShortcut();
00100
00101 void slotShowPluginOptions(const QString& _pluginName );
00102
00104 void restoreKeyPresets();
00105
00107 void updateViewerSettings(int _row);
00108
00110 void viewerSettingsChanged(QListWidgetItem* _item);
00111 void viewerSettingsChanged(int _index);
00112
00114 void switchStackedWidget();
00115
00117 void updateSliderCounter();
00118
00122 void slotPreviewStereoSettings(int _tmpParam = 0);
00123
00124 protected:
00125 void showEvent ( QShowEvent * event );
00126
00127 private:
00128
00129
00130 void initPluginOptions();
00131
00132 QVBoxLayout* pluginOptionsLayout;
00133
00134
00135 std::vector<PluginInfo>& plugins_;
00136 std::vector<KeyBinding>& coreKeys_;
00137
00138 InverseKeyMap& keys_;
00139
00140 int getPluginInfo(QString pluginName);
00141
00142 void initKeyTree();
00143
00144 void applyShortcuts();
00145
00146
00147 bool httpRequestAborted;
00148
00149
00150 int httpGetId;
00151
00152
00153 QHttp *http;
00154
00155
00156 QFile *file;
00157
00158
00159 QProgressDialog *progressDialog;
00160
00161
00162 enum DOWNLOAD {
00163 NONE,
00164 VERSIONS_FILE,
00165 PLUGIN,
00166 WINDOWS_SETUP
00167 } downloadType;
00168
00169
00170 std::vector< ACG::SceneGraph::DrawModes::DrawMode > defaultDrawModes_;
00171 std::vector< int > defaultProjectionMode_;
00172 std::vector< int > defaultViewingDirections_;
00173
00174 bool updatingViewerSettings_;
00175
00176 private:
00178 void startDownload( QString _url );
00179
00181 void compareVersions();
00182
00184 bool isNewer(QString _current, QString _latest);
00185
00187 void updateVersionsTable();
00188
00189 private slots:
00190
00191
00192 void httpRequestFinished(int requestId, bool error);
00193
00194
00195 void readResponseHeader(const QHttpResponseHeader &responseHeader);
00196
00197
00198 void updateDataReadProgress(int bytesRead, int totalBytes);
00199
00200
00201 void cancelDownload();
00202
00203
00204 void updateComponent();
00205
00206 private:
00209 QStringList updatedPlugins_;
00210
00213 QString pluginPath_;
00214
00217 QString currentUpdateName_;
00218
00219
00220 };
00221
00222 #endif //OPTIONSWIDGET_HH