annotate src/multichoicedialog.h @ 609:c1451b356097

Wording and menu grouping adjustments to try to make the default push/pull location function look less like it will open a new remote for you (mitigates #461)
author Chris Cannam
date Tue, 03 Jul 2012 13:11:00 +0100
parents 98f57888d893
children ae67ea0af696
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@560 8 Copyright (c) 2012 Chris Cannam
Chris@560 9 Copyright (c) 2012 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@69 21 #include "recentfiles.h"
Chris@69 22
Chris@67 23 #include <QDialog>
Chris@67 24 #include <QString>
Chris@69 25 #include <QAbstractButton>
Chris@68 26 #include <QMap>
Chris@68 27 #include <QLabel>
Chris@68 28 #include <QLineEdit>
Chris@68 29 #include <QGridLayout>
Chris@69 30 #include <QHBoxLayout>
Chris@68 31 #include <QStackedWidget>
Chris@69 32 #include <QSharedPointer>
Chris@69 33 #include <QComboBox>
Chris@67 34
Chris@67 35 class MultiChoiceDialog : public QDialog
Chris@67 36 {
Chris@67 37 Q_OBJECT
Chris@67 38 public:
Chris@69 39 explicit MultiChoiceDialog(QString title, QString heading,
Chris@69 40 QWidget *parent = 0);
Chris@67 41
Chris@67 42 enum ArgType {
Chris@67 43 NoArg,
Chris@67 44 FileArg,
Chris@69 45 DirectoryArg,
Chris@67 46 UrlArg,
Chris@72 47 UrlToDirectoryArg
Chris@67 48 };
Chris@67 49
Chris@67 50 void addChoice(QString identifier, QString text,
Chris@553 51 QString description, ArgType arg,
Chris@553 52 bool defaultEmpty = false);
Chris@67 53
Chris@69 54 void setCurrentChoice(QString);
Chris@69 55 QString getCurrentChoice();
Chris@67 56 QString getArgument();
Chris@72 57 QString getAdditionalArgument();
Chris@67 58
Chris@72 59 static void addRecentArgument(QString identifier, QString name,
Chris@72 60 bool additionalArgument = false);
Chris@67 61
Chris@68 62 private slots:
Chris@69 63 void choiceChanged();
Chris@72 64 void urlChanged(const QString &);
Chris@74 65 void fileChanged(const QString &);
Chris@69 66 void browse();
Chris@68 67
Chris@68 68 private:
Chris@483 69 void updateFileComboFromURL();
Chris@199 70 void updateOkButton();
Chris@199 71
Chris@68 72 QMap<QString, QString> m_texts;
Chris@68 73 QMap<QString, QString> m_descriptions;
Chris@69 74 QMap<QString, ArgType> m_argTypes;
Chris@553 75 QMap<QString, bool> m_defaultEmpty;
Chris@69 76 QMap<QString, QSharedPointer<RecentFiles> > m_recentFiles;
Chris@68 77
Chris@68 78 QString m_currentChoice;
Chris@69 79 QMap<QWidget *, QString> m_choiceButtons;
Chris@68 80
Chris@69 81 QHBoxLayout *m_choiceLayout;
Chris@68 82 QLabel *m_descriptionLabel;
Chris@72 83 QLabel *m_fileLabel;
Chris@72 84 QComboBox *m_fileCombo;
Chris@69 85 QAbstractButton *m_browseButton;
Chris@72 86 QLabel *m_urlLabel;
Chris@72 87 QComboBox *m_urlCombo;
Chris@74 88 QAbstractButton *m_okButton;
Chris@342 89
Chris@342 90 QString getDefaultPath() const;
Chris@604 91 bool urlComboNotUrl() const;
Chris@67 92 };
Chris@67 93
Chris@67 94 #endif // MULTICHOICEDIALOG_H