annotate multichoicedialog.h @ 68:b918e57c7bea

* Flesh out multi-choice dialog a big
author Chris Cannam
date Wed, 17 Nov 2010 22:13:34 +0000
parents be627aeceaed
children 6d5a5571caec
rev   line source
Chris@67 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@67 2
Chris@67 3 /*
Chris@67 4 EasyMercurial
Chris@67 5
Chris@67 6 Based on HgExplorer by Jari Korhonen
Chris@67 7 Copyright (c) 2010 Jari Korhonen
Chris@67 8 Copyright (c) 2010 Chris Cannam
Chris@67 9 Copyright (c) 2010 Queen Mary, University of London
Chris@67 10
Chris@67 11 This program is free software; you can redistribute it and/or
Chris@67 12 modify it under the terms of the GNU General Public License as
Chris@67 13 published by the Free Software Foundation; either version 2 of the
Chris@67 14 License, or (at your option) any later version. See the file
Chris@67 15 COPYING included with this distribution for more information.
Chris@67 16 */
Chris@67 17
Chris@67 18 #ifndef MULTICHOICEDIALOG_H
Chris@67 19 #define MULTICHOICEDIALOG_H
Chris@67 20
Chris@67 21 #include <QDialog>
Chris@67 22 #include <QString>
Chris@68 23 #include <QPushButton>
Chris@68 24 #include <QMap>
Chris@68 25 #include <QLabel>
Chris@68 26 #include <QLineEdit>
Chris@68 27 #include <QGridLayout>
Chris@68 28 #include <QStackedWidget>
Chris@67 29
Chris@67 30 class MultiChoiceDialog : public QDialog
Chris@67 31 {
Chris@67 32 Q_OBJECT
Chris@67 33 public:
Chris@68 34 explicit MultiChoiceDialog(QString title, QString heading, QWidget *parent = 0);
Chris@67 35
Chris@67 36 enum ArgType {
Chris@67 37 NoArg,
Chris@67 38 FileArg,
Chris@67 39 UrlArg,
Chris@67 40 FileOrUrlArg
Chris@67 41 };
Chris@67 42
Chris@67 43 void addChoice(QString identifier, QString text,
Chris@67 44 QString description, ArgType arg);
Chris@67 45
Chris@67 46 QString getSelectedIdentifier();
Chris@67 47 QString getArgument();
Chris@67 48
Chris@67 49 signals:
Chris@67 50
Chris@68 51 private slots:
Chris@68 52
Chris@68 53
Chris@68 54 private:
Chris@68 55 void updateArgWidgets(); // when choice changes
Chris@68 56
Chris@68 57 QMap<QString, QString> m_texts;
Chris@68 58 QMap<QString, QString> m_descriptions;
Chris@68 59
Chris@68 60 QString m_currentChoice;
Chris@68 61 QMap<QString, QPushButton *> m_choiceButtons;
Chris@68 62
Chris@68 63 QGridLayout *m_choiceLayout;
Chris@68 64 QLabel *m_descriptionLabel;
Chris@68 65 QLabel *m_argLabel;
Chris@68 66 QLineEdit *m_argEdit;
Chris@68 67 QPushButton *m_browseButton;
Chris@67 68
Chris@67 69 };
Chris@67 70
Chris@67 71 #endif // MULTICHOICEDIALOG_H