Added changeEvent calls where appropriate

Need to call into the superclass in order not to lose functionality. Was
missing in the wizard, hence the many missing occurrences.

Reviewed-by: Friedemann Kleint
This commit is contained in:
Thorbjørn Lindeijer
2009-03-17 14:34:27 +01:00
parent 70d5649428
commit 4e16705a27
9 changed files with 55 additions and 43 deletions

View File

@@ -258,6 +258,7 @@ void BranchDialog::slotRemoteBranchActivated(const QModelIndex &i)
void BranchDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_ui->retranslateUi(this);

View File

@@ -3,64 +3,68 @@
#include <QtGui/QDialog>
QT_BEGIN_NAMESPACE
class QPushButton;
class QModelIndex;
QT_END_NAMESPACE
namespace Git {
namespace Internal {
namespace Ui {
class BranchDialog;
}
namespace Internal {
class GitClient;
class LocalBranchModel;
class RemoteBranchModel;
namespace Ui {
class BranchDialog;
}
/* Branch dialog: Display a list of local branches at the top
* and remote branches below. Offers to checkout/delete local
* branches.
* TODO: Add new branch (optionally tracking a remote one).
* How to find out that a local branch is a tracking one? */
class BranchDialog : public QDialog {
Q_OBJECT
Q_DISABLE_COPY(BranchDialog)
public:
explicit BranchDialog(QWidget *parent = 0);
class GitClient;
class LocalBranchModel;
class RemoteBranchModel;
bool init(GitClient *client, const QString &workingDirectory, QString *errorMessage);
/**
* Branch dialog. Displays a list of local branches at the top and remote
* branches below. Offers to checkout/delete local branches.
*
* TODO: Add new branch (optionally tracking a remote one).
* How to find out that a local branch is a tracking one?
*/
class BranchDialog : public QDialog {
Q_OBJECT
Q_DISABLE_COPY(BranchDialog)
public:
explicit BranchDialog(QWidget *parent = 0);
virtual ~BranchDialog();
bool init(GitClient *client, const QString &workingDirectory, QString *errorMessage);
protected:
virtual void changeEvent(QEvent *e);
virtual ~BranchDialog();
private slots:
void slotEnableButtons();
void slotCheckoutSelectedBranch();
void slotDeleteSelectedBranch();
void slotLocalBranchActivated();
void slotRemoteBranchActivated(const QModelIndex &);
void slotCreateLocalBranch(const QString &branchName);
protected:
virtual void changeEvent(QEvent *e);
private:
bool ask(const QString &title, const QString &what, bool defaultButton);
void selectLocalBranch(const QString &b);
private slots:
void slotEnableButtons();
void slotCheckoutSelectedBranch();
void slotDeleteSelectedBranch();
void slotLocalBranchActivated();
void slotRemoteBranchActivated(const QModelIndex &);
void slotCreateLocalBranch(const QString &branchName);
int selectedLocalBranchIndex() const;
int selectedRemoteBranchIndex() const;
private:
bool ask(const QString &title, const QString &what, bool defaultButton);
void selectLocalBranch(const QString &b);
GitClient *m_client;
Ui::BranchDialog *m_ui;
QPushButton *m_checkoutButton;
QPushButton *m_deleteButton;
int selectedLocalBranchIndex() const;
int selectedRemoteBranchIndex() const;
LocalBranchModel *m_localModel;
RemoteBranchModel *m_remoteModel;
QString m_repoDirectory;
};
} // namespace Internal
GitClient *m_client;
Ui::BranchDialog *m_ui;
QPushButton *m_checkoutButton;
QPushButton *m_deleteButton;
LocalBranchModel *m_localModel;
RemoteBranchModel *m_remoteModel;
QString m_repoDirectory;
};
} // namespace Internal
} // namespace Git
#endif // BRANCHDIALOG_H