comparison src/multichoicedialog.h @ 370:b9c153e00e84

Move source files to src/
author Chris Cannam
date Thu, 24 Mar 2011 10:27:51 +0000
parents multichoicedialog.h@3824e8bb91eb
children a582c6417004
comparison
equal deleted inserted replaced
369:19cce6d2c470 370:b9c153e00e84
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 EasyMercurial
5
6 Based on HgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2011 Chris Cannam
9 Copyright (c) 2011 Queen Mary, University of London
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18 #ifndef MULTICHOICEDIALOG_H
19 #define MULTICHOICEDIALOG_H
20
21 #include "recentfiles.h"
22
23 #include <QDialog>
24 #include <QString>
25 #include <QAbstractButton>
26 #include <QMap>
27 #include <QLabel>
28 #include <QLineEdit>
29 #include <QGridLayout>
30 #include <QHBoxLayout>
31 #include <QStackedWidget>
32 #include <QSharedPointer>
33 #include <QComboBox>
34
35 class MultiChoiceDialog : public QDialog
36 {
37 Q_OBJECT
38 public:
39 explicit MultiChoiceDialog(QString title, QString heading,
40 QWidget *parent = 0);
41
42 enum ArgType {
43 NoArg,
44 FileArg,
45 DirectoryArg,
46 UrlArg,
47 UrlToDirectoryArg
48 };
49
50 void addChoice(QString identifier, QString text,
51 QString description, ArgType arg);
52
53 void setCurrentChoice(QString);
54 QString getCurrentChoice();
55 QString getArgument();
56 QString getAdditionalArgument();
57
58 static void addRecentArgument(QString identifier, QString name,
59 bool additionalArgument = false);
60
61 private slots:
62 void choiceChanged();
63 void urlChanged(const QString &);
64 void fileChanged(const QString &);
65 void browse();
66
67 private:
68 void updateOkButton();
69
70 QMap<QString, QString> m_texts;
71 QMap<QString, QString> m_descriptions;
72 QMap<QString, ArgType> m_argTypes;
73 QMap<QString, QSharedPointer<RecentFiles> > m_recentFiles;
74
75 QString m_currentChoice;
76 QMap<QWidget *, QString> m_choiceButtons;
77
78 QHBoxLayout *m_choiceLayout;
79 QLabel *m_descriptionLabel;
80 QLabel *m_fileLabel;
81 QComboBox *m_fileCombo;
82 QAbstractButton *m_browseButton;
83 QLabel *m_urlLabel;
84 QComboBox *m_urlCombo;
85 QAbstractButton *m_okButton;
86
87 QString getDefaultPath() const;
88 };
89
90 #endif // MULTICHOICEDIALOG_H