Skip to content

Commit

Permalink
Refactor GenerateCommitMessageDialog class and add regenerate functio…
Browse files Browse the repository at this point in the history
…nality
  • Loading branch information
soramimi committed May 18, 2024
1 parent d739e76 commit 5efae9d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/GenerateCommitMessageDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "GenerateCommitMessageDialog.h"
#include "ui_ChoiceCommitMessageDialog.h"
#include "ui_GenerateCommitMessageDialog.h"
#include "CommitMessageGenerator.h"
#include "ApplicationGlobal.h"
#include "MainWindow.h"

GenerateCommitMessageDialog::GenerateCommitMessageDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::GenerateCommitMessageWithAiDialog)
, ui(new Ui::GenerateCommitMessageDialog)
{
ui->setupUi(this);
}
Expand Down Expand Up @@ -36,4 +36,8 @@ void GenerateCommitMessageDialog::generate()
}
}

void GenerateCommitMessageDialog::on_pushButton_regenerate_clicked()
{
generate();
}

6 changes: 4 additions & 2 deletions src/GenerateCommitMessageDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
#include <QDialog>

namespace Ui {
class GenerateCommitMessageWithAiDialog;
class GenerateCommitMessageDialog;
}

class GenerateCommitMessageDialog : public QDialog {
Q_OBJECT
private:
Ui::GenerateCommitMessageWithAiDialog *ui;
Ui::GenerateCommitMessageDialog *ui;
public:
explicit GenerateCommitMessageDialog(QWidget *parent = nullptr);
~GenerateCommitMessageDialog();
QString text() const;
void generate();
private slots:
void on_pushButton_regenerate_clicked();
};

#endif // GENERATECOMMITMESSAGEDIALOG_H
24 changes: 20 additions & 4 deletions src/GenerateCommitMessageDialog.ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GenerateCommitMessageWithAiDialog</class>
<widget class="QDialog" name="GenerateCommitMessageWithAiDialog">
<class>GenerateCommitMessageDialog</class>
<widget class="QDialog" name="GenerateCommitMessageDialog">
<property name="geometry">
<rect>
<x>0</x>
Expand All @@ -19,6 +19,13 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_regenerate">
<property name="text">
<string>Regenerate</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
Expand All @@ -37,6 +44,9 @@
<property name="text">
<string>OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
Expand All @@ -50,12 +60,18 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>listWidget</tabstop>
<tabstop>pushButton_regenerate</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>pushButton_2</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>GenerateCommitMessageWithAiDialog</receiver>
<receiver>GenerateCommitMessageDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
Expand All @@ -71,7 +87,7 @@
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>GenerateCommitMessageWithAiDialog</receiver>
<receiver>GenerateCommitMessageDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
Expand Down

0 comments on commit 5efae9d

Please sign in to comment.