comparison multichoicedialog.h @ 69:6d5a5571caec

* Basic working "Open Repository" dialog
author Chris Cannam
date Thu, 18 Nov 2010 15:14:39 +0000
parents b918e57c7bea
children 121cb1032717
comparison
equal deleted inserted replaced
68:b918e57c7bea 69:6d5a5571caec
16 */ 16 */
17 17
18 #ifndef MULTICHOICEDIALOG_H 18 #ifndef MULTICHOICEDIALOG_H
19 #define MULTICHOICEDIALOG_H 19 #define MULTICHOICEDIALOG_H
20 20
21 #include "recentfiles.h"
22
21 #include <QDialog> 23 #include <QDialog>
22 #include <QString> 24 #include <QString>
23 #include <QPushButton> 25 #include <QAbstractButton>
24 #include <QMap> 26 #include <QMap>
25 #include <QLabel> 27 #include <QLabel>
26 #include <QLineEdit> 28 #include <QLineEdit>
27 #include <QGridLayout> 29 #include <QGridLayout>
30 #include <QHBoxLayout>
28 #include <QStackedWidget> 31 #include <QStackedWidget>
32 #include <QSharedPointer>
33 #include <QComboBox>
29 34
30 class MultiChoiceDialog : public QDialog 35 class MultiChoiceDialog : public QDialog
31 { 36 {
32 Q_OBJECT 37 Q_OBJECT
33 public: 38 public:
34 explicit MultiChoiceDialog(QString title, QString heading, QWidget *parent = 0); 39 explicit MultiChoiceDialog(QString title, QString heading,
40 QWidget *parent = 0);
35 41
36 enum ArgType { 42 enum ArgType {
37 NoArg, 43 NoArg,
38 FileArg, 44 FileArg,
45 DirectoryArg,
39 UrlArg, 46 UrlArg,
40 FileOrUrlArg 47 FileOrUrlArg
41 }; 48 };
42 49
43 void addChoice(QString identifier, QString text, 50 void addChoice(QString identifier, QString text,
44 QString description, ArgType arg); 51 QString description, ArgType arg);
45 52
46 QString getSelectedIdentifier(); 53 void setCurrentChoice(QString);
54 QString getCurrentChoice();
47 QString getArgument(); 55 QString getArgument();
48 56
49 signals: 57 static void addRecentArgument(QString identifier, QString name);
50 58
51 private slots: 59 private slots:
52 60 void choiceChanged();
61 void browse();
53 62
54 private: 63 private:
55 void updateArgWidgets(); // when choice changes
56
57 QMap<QString, QString> m_texts; 64 QMap<QString, QString> m_texts;
58 QMap<QString, QString> m_descriptions; 65 QMap<QString, QString> m_descriptions;
66 QMap<QString, ArgType> m_argTypes;
67 QMap<QString, QSharedPointer<RecentFiles> > m_recentFiles;
59 68
60 QString m_currentChoice; 69 QString m_currentChoice;
61 QMap<QString, QPushButton *> m_choiceButtons; 70 QMap<QWidget *, QString> m_choiceButtons;
62 71
63 QGridLayout *m_choiceLayout; 72 QHBoxLayout *m_choiceLayout;
64 QLabel *m_descriptionLabel; 73 QLabel *m_descriptionLabel;
65 QLabel *m_argLabel; 74 QLabel *m_argLabel;
66 QLineEdit *m_argEdit; 75 QComboBox *m_argEdit;
67 QPushButton *m_browseButton; 76 QAbstractButton *m_browseButton;
68
69 }; 77 };
70 78
71 #endif // MULTICHOICEDIALOG_H 79 #endif // MULTICHOICEDIALOG_H