Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F133424
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
8 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/AboutDialog.ui b/src/AboutDialog.ui
index f91c293..f1d87e6 100644
--- a/src/AboutDialog.ui
+++ b/src/AboutDialog.ui
@@ -1,59 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
- <x>210</x>
- <y>190</y>
- <width>181</width>
- <height>68</height>
+ <x>200</x>
+ <y>170</y>
+ <width>191</width>
+ <height>91</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_title">
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_copyright">
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_twitter">
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_qt">
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
diff --git a/src/CheckoutDialog.cpp b/src/CheckoutDialog.cpp
index 4149eec..15736ee 100644
--- a/src/CheckoutDialog.cpp
+++ b/src/CheckoutDialog.cpp
@@ -1,146 +1,150 @@
#include "CheckoutDialog.h"
#include "ui_CheckoutDialog.h"
-
+#include <set>
#include <QLineEdit>
struct CheckoutDialog::Private {
QStringList tags;
QStringList all_local_branch_names;
QStringList local_branch_names;
QStringList remote_branch_names;
};
CheckoutDialog::CheckoutDialog(QWidget *parent, QStringList const &tags, QStringList const &all_local_branches, QStringList const &local_branches, QStringList const &remote_branches)
: QDialog(parent)
, ui(new Ui::CheckoutDialog)
, m(new Private)
{
ui->setupUi(this);
Qt::WindowFlags flags = windowFlags();
flags &= ~Qt::WindowContextHelpButtonHint;
setWindowFlags(flags);
m->tags = tags;
m->all_local_branch_names = all_local_branches;
m->local_branch_names = local_branches;
m->remote_branch_names = remote_branches;
ui->radioButton_head_detached->setText("HEAD detached");
ui->radioButton_existing_local_branch->setText("Existing local branch");
ui->radioButton_create_local_branch->setText("Create local branch");
- Operation op = makeComboBoxOptions(true);
-
-// QRadioButton *sel = nullptr;
-// if (op == Operation::ExistingLocalBranch) {
-// sel = ui->radioButton_existing_local_branch;
-// } else {
-// ui->radioButton_existing_local_branch->setEnabled(false);
-// sel = ui->radioButton_create_local_branch;
-// }
-// if (sel) {
-// sel->setFocus();
-// sel->click();
-// }
+ makeComboBoxOptions(true);
}
CheckoutDialog::~CheckoutDialog()
{
delete m;
delete ui;
}
int CheckoutDialog::makeComboBoxOptionsFromList(QStringList const &names)
{
int count = 0;
ui->comboBox_branch_name->clear();
ui->comboBox_branch_name->clearEditText();
for (QString const &name : names) {
int i = name.lastIndexOf('/');
if (i < 0 && name == "HEAD") continue;
if (i > 0 && name.mid(i + 1) == "HEAD") continue;
ui->comboBox_branch_name->addItem(name);
count++;
}
return count;
}
CheckoutDialog::Operation CheckoutDialog::makeComboBoxOptions(bool click)
{
+ // ローカルブランチがあればそれを優先して選択
if (makeComboBoxOptionsFromList(m->local_branch_names) > 0) {
auto *rb = ui->radioButton_existing_local_branch;
rb->setFocus();
if (click) rb->click();
return Operation::ExistingLocalBranch;
}
+ // 全ローカルブランチ名をコンボボックスに追加
bool f = makeComboBoxOptionsFromList(m->all_local_branch_names);
ui->radioButton_existing_local_branch->setEnabled(f);
+ // リモートブランチ名と同じローカルブランチが既存なら
+ for (QString const &name : m->all_local_branch_names) {
+ if (m->remote_branch_names.indexOf(name) >= 0) {
+ ui->comboBox_branch_name->setCurrentText(name);
+ {
+ auto *rb = ui->radioButton_existing_local_branch;
+ rb->setFocus();
+ if (click) rb->click();
+ }
+ return Operation::ExistingLocalBranch;
+ }
+ }
+
+ // ブランチ新規作成
{
auto *rb = ui->radioButton_create_local_branch;
rb->setFocus();
if (click) rb->click();
}
return Operation::CreateLocalBranch;
}
void CheckoutDialog::clearComboBoxOptions()
{
ui->comboBox_branch_name->clear();
ui->comboBox_branch_name->clearEditText();
}
CheckoutDialog::Operation CheckoutDialog::operation() const
{
if (ui->radioButton_existing_local_branch->isChecked()) return Operation::ExistingLocalBranch;
if (ui->radioButton_create_local_branch->isChecked()) return Operation::CreateLocalBranch;
return Operation::HeadDetached;
}
QString CheckoutDialog::branchName() const
{
if (operation() == Operation::HeadDetached) {
return QString();
}
return ui->comboBox_branch_name->currentText();
}
void CheckoutDialog::updateUI()
{
if (ui->radioButton_head_detached->isChecked()) {
clearComboBoxOptions();
ui->comboBox_branch_name->setEditable(false);
ui->comboBox_branch_name->setEnabled(false);
} else if (ui->radioButton_existing_local_branch->isChecked()) {
ui->comboBox_branch_name->setEnabled(true);
ui->comboBox_branch_name->setEditable(false);
makeComboBoxOptions(false);
} else if (ui->radioButton_create_local_branch->isChecked()) {
ui->comboBox_branch_name->setEnabled(true);
ui->comboBox_branch_name->setEditable(true);
QStringList names;
names.append(m->tags);
names.append(m->remote_branch_names);
makeComboBoxOptionsFromList(names);
QLineEdit *e = ui->comboBox_branch_name->lineEdit();
e->setFocus();
e->selectAll();
}
}
void CheckoutDialog::on_radioButton_head_detached_toggled(bool /*checked*/)
{
updateUI();
}
void CheckoutDialog::on_radioButton_existing_local_branch_toggled(bool /*checked*/)
{
updateUI();
}
void CheckoutDialog::on_radioButton_create_local_branch_toggled(bool /*checked*/)
{
updateUI();
}
diff --git a/src/CommitPropertyDialog.h b/src/CommitPropertyDialog.h
index 8f33ca4..fe8af68 100644
--- a/src/CommitPropertyDialog.h
+++ b/src/CommitPropertyDialog.h
@@ -1,46 +1,41 @@
#ifndef COMMITPROPERTYDIALOG_H
#define COMMITPROPERTYDIALOG_H
#include <QDialog>
#include "Git.h"
class QLabel;
namespace Ui {
class CommitPropertyDialog;
}
class BasicMainWindow;
class CommitPropertyDialog : public QDialog {
Q_OBJECT
private:
struct Private;
Private *m;
public:
explicit CommitPropertyDialog(QWidget *parent, BasicMainWindow *mw, Git::CommitItem const *commit);
explicit CommitPropertyDialog(QWidget *parent, BasicMainWindow *mw, QString const &commit_id);
~CommitPropertyDialog() override;
void showCheckoutButton(bool f);
void showJumpButton(bool f);
private slots:
-
void on_pushButton_checkout_clicked();
-
- void on_pushButton_jump_clicked();
-
void on_pushButton_details_clicked();
-
void on_pushButton_explorer_clicked();
-
+ void on_pushButton_jump_clicked();
private:
Ui::CommitPropertyDialog *ui;
void init(BasicMainWindow *mw);
BasicMainWindow *mainwindow();
void setAvatar(const QIcon &icon, QLabel *label);
void updateAvatar(bool request);
};
#endif // COMMITPROPERTYDIALOG_H
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jun 16, 1:48 AM (2 w, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70338
Default Alt Text
(8 KB)
Attached To
Mode
R77 Guitar
Attached
Detach File
Event Timeline