Skip to content

Commit

Permalink
Tweak UI logic and styling here and there
Browse files Browse the repository at this point in the history
  • Loading branch information
leikareipa committed Oct 2, 2023
1 parent 1fca9c6 commit 9fc8080
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/capture/video_presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void kvideopreset_assign_presets(const std::vector<analog_video_preset_s*> &pres
kvideopreset_remove_all_presets();

PRESETS = presets;
kvideopreset_apply_current_active_preset();

RUNNING_PRESET_ID = (1 + (*std::max_element(PRESETS.begin(), PRESETS.end(), [](const analog_video_preset_s *a, const analog_video_preset_s *b){return a->id < b->id;}))->id);

Expand Down
2 changes: 1 addition & 1 deletion src/display/qt/stylesheets/default/scrollbars.qss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ QScrollBar::sub-line:vertical

QScrollBar::sub-line:vertical:disabled
{
image: url(:/res/icons/newie/newie/arrow_up_disabled.png);
image: url(:/res/icons/newie/arrow_up_disabled.png);
}

QScrollBar:horizontal
Expand Down
13 changes: 13 additions & 0 deletions src/display/qt/windows/ControlPanel/Output/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ control_panel::output::Overlay::Overlay(QWidget *parent) :
});
}

// Listen for app events.
{
ev_capture_signal_gained.listen([this]
{
this->ui->groupBox->setEnabled(true);
});

ev_capture_signal_lost.listen([this]
{
this->ui->groupBox->setEnabled(false);
});
}

// Restore persistent settings.
{
ui->plainTextEdit->setPlainText(kpers_value_of(INI_GROUP_OVERLAY, "Content", "").toString());
Expand Down
18 changes: 13 additions & 5 deletions src/display/qt/windows/ControlPanel/VideoPresets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,19 @@ control_panel::VideoPresets::VideoPresets(QWidget *parent) :

connect(this, &VideoPresets::preset_activation_rules_changed, this, [this]
{
kvideopreset_apply_current_active_preset();
if (CONTROLS_LIVE_UPDATE)
{
kvideopreset_apply_current_active_preset();
}
});

connect(ui->comboBox_presetList, &VideoPresetList::preset_selected, this, [this]
{
CONTROLS_LIVE_UPDATE = false;
this->lock_unsaved_changes_flag(true);
this->update_preset_controls_with_current_preset_data();
this->lock_unsaved_changes_flag(false);
CONTROLS_LIVE_UPDATE = true;

this->update_active_preset_indicator();
});
Expand Down Expand Up @@ -217,9 +222,16 @@ control_panel::VideoPresets::VideoPresets(QWidget *parent) :

if (selectedPreset && (QMessageBox::question(this, "Confirm preset deletion", "Are you sure you want to delete this preset?", (QMessageBox::No | QMessageBox::Yes)) == QMessageBox::Yes))
{
const bool wasActivePreset = kvideopreset_is_preset_active(selectedPreset);

ui->comboBox_presetList->remove_preset(selectedPreset->id);
kvideopreset_remove_preset(selectedPreset->id);
emit this->data_changed();

if (wasActivePreset)
{
kvideopreset_apply_current_active_preset();
}
}
});

Expand Down Expand Up @@ -643,8 +655,6 @@ void control_panel::VideoPresets::update_preset_controls_with_current_preset_dat

// Assign the video parameter values.
{
CONTROLS_LIVE_UPDATE = false;

const auto &currentParams = preset->properties;
this->update_property_control_ranges(currentParams);

Expand All @@ -661,8 +671,6 @@ void control_panel::VideoPresets::update_preset_controls_with_current_preset_dat
ui->parameterGrid_properties->set_value(PROP_LABEL_RED_CONTRAST, currentParams.redContrast);
ui->parameterGrid_properties->set_value(PROP_LABEL_GREEN_CONTRAST, currentParams.greenContrast);
ui->parameterGrid_properties->set_value(PROP_LABEL_BLUE_CONTRAST, currentParams.blueContrast);

CONTROLS_LIVE_UPDATE = true;
}

return;
Expand Down
17 changes: 9 additions & 8 deletions src/display/qt/windows/OutputWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,17 @@ void OutputWindow::update_window_title(void)
.arg(outRes.h);
}
}
}

{
const analog_video_preset_s *currentAnalogPreset = kvideopreset_current_active_preset();
// Add the name of the current preset, if any.
{
const analog_video_preset_s *currentAnalogPreset = kvideopreset_current_active_preset();

if (
currentAnalogPreset &&
!currentAnalogPreset->name.empty()
){
title += QString(" - \"%1\"").arg(QString::fromStdString(currentAnalogPreset->name));
if (
currentAnalogPreset &&
!currentAnalogPreset->name.empty()
){
title += QString(" - \"%1\"").arg(QString::fromStdString(currentAnalogPreset->name));
}
}
}

Expand Down

0 comments on commit 9fc8080

Please sign in to comment.