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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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();
00070     void languageChanged();
00072     void styleChanged();
00073     bool eventFilter(QObject *object, QEvent *event);
00074     void setSimpleStyle(bool b);
00075     
00076 public slots:
00078     void setVisible(bool);
00079 
00080 protected:
00081     Ui_searchDialogForm* ui;
00083     virtual void createDialogContent();
00084 
00085 private slots:
00087     void onSimbadStatusChanged();
00089     void onTextChanged(const QString& text);
00090     
00091     void gotoObject();
00092     
00094     void manualPositionChanged();
00095     
00096 private:
00097     class SimbadSearcher* simbadSearcher;
00098     class SimbadLookupReply* simbadReply;
00099     QMap<QString, Vec3d> simbadResults;
00100     class StelObjectMgr* objectMgr;
00101     
00102     QString substituteGreek(const QString& keyString);
00103     QString getGreekLetterByName(const QString& potentialGreekLetterName);
00104     QHash<QString, QString> greekLetters;
00105 };
00106 
00107 #endif // _SEARCHDIALOG_HPP_
00108