Stellarium 0.12.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · File Structure

SearchDialog.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2008 Guillaume Chereau
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
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 // pre declaration of the ui class
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     // for going from list views
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     // retranslate/recreate tab
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 
Generated on Thu Jan 31 14:05:42 2013 for Stellarium by  doxygen 1.6.3