SearchDialog.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _SEARCHDIALOG_HPP_
00021 #define _SEARCHDIALOG_HPP_
00022
00023 #include <QObject>
00024 #include <QLabel>
00025 #include <QMap>
00026 #include <QHash>
00027 #include "StelDialog.hpp"
00028 #include "VecMath.hpp"
00029
00030
00031 class Ui_searchDialogForm;
00032
00036 class CompletionLabel : public QLabel
00037 {
00038 Q_OBJECT
00039
00040 public:
00041 CompletionLabel(QWidget* parent=0);
00042 ~CompletionLabel();
00043
00044 QString getSelected(void);
00045 void setValues(const QStringList&);
00046 bool isEmpty() const {return values.isEmpty();}
00047 void appendValues(const QStringList&);
00048 void clearValues();
00049
00050 public slots:
00051 void selectNext();
00052 void selectPrevious();
00053 void selectFirst();
00054
00055 private:
00056 void updateText();
00057 int selectedIdx;
00058 QStringList values;
00059 };
00060
00061 QT_FORWARD_DECLARE_CLASS(QListWidgetItem)
00062
00063
00064
00065 class SearchDialog : public StelDialog
00066 {
00067 Q_OBJECT
00068
00069 public:
00070 SearchDialog();
00071 virtual ~SearchDialog();
00073 void styleChanged();
00074 bool eventFilter(QObject *object, QEvent *event);
00075
00076 public slots:
00077 void retranslate();
00079 void setVisible(bool);
00081 void setSimpleStyle();
00082
00083 protected:
00084 Ui_searchDialogForm* ui;
00086 virtual void createDialogContent();
00087
00088 private slots:
00089 void greekLetterClicked();
00091 void onSimbadStatusChanged();
00093 void onSearchTextChanged(const QString& text);
00094
00095 void gotoObject();
00096 void gotoObject(const QString& nameI18n);
00097
00098 void gotoObject(QListWidgetItem* item);
00099
00100 void searchListChanged(const QString& newText);
00101
00103 void manualPositionChanged();
00104
00106 void enableSimbadSearch(bool enable);
00107
00109 void setHasSelectedFlag();
00110
00112 void selectSimbadServer(int index);
00113
00115 void updateListWidget(int index);
00116
00117
00118 void updateListTab();
00119
00120 private:
00121 class SimbadSearcher* simbadSearcher;
00122 class SimbadLookupReply* simbadReply;
00123 QMap<QString, Vec3d> simbadResults;
00124 class StelObjectMgr* objectMgr;
00125
00126 QString substituteGreek(const QString& keyString);
00127 QString getGreekLetterByName(const QString& potentialGreekLetterName);
00128 QHash<QString, QString> greekLetters;
00130 bool flagHasSelectedText;
00131
00132 bool useSimbad;
00134 QString simbadServerUrl;
00135 void populateSimbadServerList();
00137 static const char* DEF_SIMBAD_URL;
00138 };
00139
00140 #endif // _SEARCHDIALOG_HPP_
00141