Skip to content

Commit

Permalink
vkconfig: Open export files
Browse files Browse the repository at this point in the history
Change-Id: I3a645a8507449da30e27c4deab56cbf27fd15f22
  • Loading branch information
christophe-lunarg committed Feb 18, 2025
1 parent 0ed717a commit 03ff654
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 26 deletions.
2 changes: 0 additions & 2 deletions vkconfig_core/type_hide_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const char* GetToken(HideMessageType value) {
"HIDE_MESSAGE_WIDGET_SETTING_FLOAT",
"HIDE_MESSAGE_WIDGET_SETTING_INT",
"HIDE_MESSAGE_WIDGET_SETTING_FRAMES",
"HIDE_MESSAGE_NOTIFICATION_EXPORT_CONFIGURATION",
"HIDE_MESSAGE_NOTIFICATION_EXPORT_LAYERS_SETTINGS",
"HIDE_MESSAGE_NOTIFICATION_LAYERS_LOADED",
"HIDE_MESSAGE_NOTIFICATION_UNORDERED_LAYER",
"HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_ALL",
Expand Down
2 changes: 0 additions & 2 deletions vkconfig_core/type_hide_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ enum HideMessageType {
HIDE_MESSAGE_WIDGET_SETTING_FLOAT,
HIDE_MESSAGE_WIDGET_SETTING_INT,
HIDE_MESSAGE_WIDGET_SETTING_FRAMES,
HIDE_MESSAGE_NOTIFICATION_EXPORT_CONFIGURATION,
HIDE_MESSAGE_NOTIFICATION_EXPORT_LAYERS_SETTINGS,
HIDE_MESSAGE_NOTIFICATION_LAYERS_LOADED,
HIDE_MESSAGE_NOTIFICATION_UNORDERED_LAYER,
HIDE_MESSAGE_NOTIFICATION_EXECUTABLE_ALL,
Expand Down
16 changes: 16 additions & 0 deletions vkconfig_gui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,22 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="launch_options_log_open">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Open the output log</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down
19 changes: 19 additions & 0 deletions vkconfig_gui/tab_applications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "../vkconfig_core/alert.h"

#include <QFileDialog>
#include <QDesktopServices>

TabApplications::TabApplications(MainWindow &window, std::shared_ptr<Ui::MainWindow> ui)
: Tab(TAB_APPLICATIONS, window, ui), _launch_application(nullptr) {
Expand All @@ -36,6 +37,7 @@ TabApplications::TabApplications(MainWindow &window, std::shared_ptr<Ui::MainWin
this->ui->launch_options_remove->setIcon(::Get(::ICON_OPTIONS_REMOVE));
this->ui->launch_options_dir_button->setIcon(::Get(::ICON_FOLDER_SEARCH));
this->ui->launch_options_log_button->setIcon(::Get(::ICON_FILE_SEARCH));
this->ui->launch_options_log_open->setIcon(::Get(::ICON_FILE_EXPORT));

this->connect(this->ui->launch_executable_list, SIGNAL(currentIndexChanged(int)), this,
SLOT(on_launch_executable_list_activated(int)));
Expand All @@ -62,6 +64,7 @@ TabApplications::TabApplications(MainWindow &window, std::shared_ptr<Ui::MainWin
this->connect(this->ui->launch_options_log_edit, SIGNAL(textEdited(QString)), this,
SLOT(on_launch_options_log_textEdited(QString)));
this->connect(this->ui->launch_options_log_button, SIGNAL(clicked()), this, SLOT(on_launch_options_log_pressed()));
this->connect(this->ui->launch_options_log_open, SIGNAL(clicked()), this, SLOT(on_launch_options_log_open_pressed()));

this->connect(this->ui->launch_clear_at_launch, SIGNAL(toggled(bool)), this, SLOT(on_launch_clear_at_launch_toggled(bool)));
this->connect(this->ui->launch_clear_log, SIGNAL(clicked()), this, SLOT(on_launch_clear_log_pressed()));
Expand Down Expand Up @@ -89,6 +92,9 @@ void TabApplications::UpdateUI(UpdateUIMode mode) {
this->ui->launch_executable_remove->setEnabled(!configurator.executables.Empty());
this->ui->launch_button->setEnabled(!configurator.executables.Empty());

const Executable *executable = configurator.executables.GetActiveExecutable();
const ExecutableOptions *options = executable->GetActiveOptions();

if (mode == UPDATE_REBUILD_UI) {
// Rebuild list of applications
ui->launch_executable_list->blockSignals(true);
Expand Down Expand Up @@ -356,6 +362,19 @@ void TabApplications::on_launch_options_log_pressed() {
}
}

void TabApplications::on_launch_options_log_open_pressed() {
Configurator &configurator = Configurator::Get();

Executable *executable = configurator.executables.GetActiveExecutable();
ExecutableOptions *options = executable->GetActiveOptions();

if (!options->log_file.Exists()) {
options->log_file.Create(true);
}

QDesktopServices::openUrl(QUrl::fromLocalFile(options->log_file.AbsolutePath().c_str()));
}

void TabApplications::on_launch_clear_at_launch_toggled(bool checked) {
Configurator::Get().executables.launcher_clear_on_launch = checked;
}
Expand Down
1 change: 1 addition & 0 deletions vkconfig_gui/tab_applications.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class TabApplications : public Tab {
void on_launch_options_envs_textEdited(const QString& text);
void on_launch_options_log_textEdited(const QString& text);
void on_launch_options_log_pressed();
void on_launch_options_log_open_pressed();

void on_launch_clear_at_launch_toggled(bool checked);
void on_launch_clear_log_pressed();
Expand Down
26 changes: 4 additions & 22 deletions vkconfig_gui/tab_configurations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,17 +783,8 @@ void TabConfigurations::OnContextMenuExportConfigsClicked(ListItem *item) {
msg.setWindowTitle("Exporting of a Loader Configuration file failed...");
msg.setText(format("Couldn't be create '%s' Loader configuration file.", selected_path.c_str()).c_str());
msg.exec();
} else if (!(configurator.Get(HIDE_MESSAGE_NOTIFICATION_EXPORT_CONFIGURATION))) {
QMessageBox msg;
msg.setIcon(QMessageBox::Information);
msg.setWindowTitle("Exporting of a Loader Configuration file successful.");
msg.setText(format("'%s' Loader configuration file was created.", selected_path.c_str()).c_str());
msg.setCheckBox(new QCheckBox("Do not show again."));
msg.exec();

if (msg.checkBox()->isChecked()) {
configurator.Set(HIDE_MESSAGE_NOTIFICATION_EXPORT_CONFIGURATION);
}
} else {
QDesktopServices::openUrl(QUrl::fromLocalFile(selected_path.c_str()));
}
}

Expand All @@ -820,17 +811,8 @@ void TabConfigurations::OnContextMenuExportSettingsClicked(ListItem *item) {
msg.setWindowTitle("Exporting of a layers settings file failed...");
msg.setText(format("Couldn't be create '%s' layers settings file.", selected_path.c_str()).c_str());
msg.exec();
} else if (!(configurator.Get(HIDE_MESSAGE_NOTIFICATION_EXPORT_LAYERS_SETTINGS))) {
QMessageBox msg;
msg.setIcon(QMessageBox::Information);
msg.setWindowTitle("Exporting of a layers Configuration file successful.");
msg.setText(format("'%s' layers configuration file was created.", selected_path.c_str()).c_str());
msg.setCheckBox(new QCheckBox("Do not show again."));
msg.exec();

if (msg.checkBox()->isChecked()) {
configurator.Set(HIDE_MESSAGE_NOTIFICATION_EXPORT_LAYERS_SETTINGS);
}
} else {
QDesktopServices::openUrl(QUrl::fromLocalFile(selected_path.c_str()));
}
}

Expand Down

0 comments on commit 03ff654

Please sign in to comment.