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

gui/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 
00063 class SearchDialog : public StelDialog
00064 {
00065     Q_OBJECT
00066 
00067 public:
00068     SearchDialog();
00069     virtual ~SearchDialog();
00071     void styleChanged();
00072     bool eventFilter(QObject *object, QEvent *event);
00073     
00074 public slots:
00075     void retranslate();
00077     void setVisible(bool);
00079     void setSimpleStyle();
00080 
00081 protected:
00082     Ui_searchDialogForm* ui;
00084     virtual void createDialogContent();
00085 
00086 private slots:
00087     void greekLetterClicked();
00089     void onSimbadStatusChanged();
00091     void onSearchTextChanged(const QString& text);
00092     
00093     void gotoObject();
00094     
00096     void manualPositionChanged();
00097 
00099     void enableSimbadSearch(bool enable);
00100 
00102     void setHasSelectedFlag();
00103 
00105     void selectSimbadServer(int index);
00106 
00107 private:
00108     class SimbadSearcher* simbadSearcher;
00109     class SimbadLookupReply* simbadReply;
00110     QMap<QString, Vec3d> simbadResults;
00111     class StelObjectMgr* objectMgr;
00112     
00113     QString substituteGreek(const QString& keyString);
00114     QString getGreekLetterByName(const QString& potentialGreekLetterName);
00115     QHash<QString, QString> greekLetters;
00117     bool flagHasSelectedText;
00118     
00119     bool useSimbad;
00121     QString simbadServerUrl;
00122     void populateSimbadServerList();
00124     static const char* DEF_SIMBAD_URL;
00125 };
00126 
00127 #endif // _SEARCHDIALOG_HPP_
00128 
Generated on Sat Aug 25 22:13:30 2012 for Stellarium by  doxygen 1.6.3