Skip to content

Commit

Permalink
ディレクトリを指定して起動する機能が動かなくなっていた問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
soramimi committed Dec 8, 2023
1 parent ed13c41 commit baa194b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ MainWindow::MainWindow(QWidget *parent)
);

loadApplicationSettings();
setupExternalPrograms();
m->starting_dir = QDir::current().absolutePath();

{ // load graphic resources
Expand Down Expand Up @@ -499,6 +500,13 @@ bool MainWindow::isUninitialized()
return !misc::isExecutable(appsettings()->git_command);
}

void MainWindow::setupExternalPrograms()
{
setGitCommand(appsettings()->git_command, false);
setGpgCommand(appsettings()->gpg_command, false);
setSshCommand(appsettings()->ssh_command, false);
}

void MainWindow::onStartEvent()
{
if (isUninitialized()) { // gitコマンドの有効性チェック
Expand All @@ -510,9 +518,7 @@ void MainWindow::onStartEvent()
postStartEvent(100); // 初期設定されなかったら、もういちどようこそダイアログを出す(100ms後)
} else {
// 外部コマンド登録
setGitCommand(appsettings()->git_command, false);
setGpgCommand(appsettings()->gpg_command, false);
setSshCommand(appsettings()->ssh_command, false);
setupExternalPrograms();

// メインウィンドウのタイトルを設定
updateWindowTitle(git());
Expand Down Expand Up @@ -1274,7 +1280,11 @@ void MainWindow::openRepository(bool validate, bool waitcursor, bool keep_select
return;
}

GitPtr g = git(); // ポインタの有効性チェックはしない(nullptrでも続行)
GitPtr g = git();
if (!g) {
qDebug() << "Guitar: git pointer is null";
return;
}
openRepository_(g, keep_selection);
}

Expand Down Expand Up @@ -5442,9 +5452,7 @@ void MainWindow::on_action_edit_settings_triggered()
if (dlg.exec() == QDialog::Accepted) {
ApplicationSettings const &newsettings = dlg.settings();
setAppSettings(newsettings);
setGitCommand(appsettings()->git_command, false);
setGpgCommand(appsettings()->gpg_command, false);
setSshCommand(appsettings()->ssh_command, false);
setupExternalPrograms();
updateAvatar(currentGitUser(), true);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ class MainWindow : public QMainWindow {
void refresh();
bool cloneRepository(const Git::CloneData &clonedata, const RepositoryData &repodata);
Git::User currentGitUser() const;
void setupExternalPrograms();
public slots:
void writeLog_(QByteArray ba, bool receive);
private slots:
Expand Down

0 comments on commit baa194b

Please sign in to comment.