Skip to content

Commit

Permalink
UI changes and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nhielost committed Jan 17, 2024
1 parent c5e6016 commit d0a2c03
Show file tree
Hide file tree
Showing 71 changed files with 3,234 additions and 3,775 deletions.
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22...3.26)
cmake_minimum_required(VERSION 3.22...3.28)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)

Expand Down Expand Up @@ -73,12 +73,10 @@ target_sources(
./src/ui/mmg-fields.cpp
./src/ui/mmg-lcd-number.cpp
./src/ui/mmg-midi-buttons.cpp
./src/ui/mmg-list-widget.cpp
./src/ui/mmg-number-display.cpp
./src/ui/mmg-string-display.cpp
./src/ui/mmg-message-display.cpp
./src/ui/mmg-action-display.cpp
./src/ui/mmg-binding-display.cpp
./src/ui/mmg-manager-display.cpp
./src/ui/mmg-echo-window.cpp)

target_sources(
Expand Down Expand Up @@ -113,12 +111,10 @@ target_sources(
./src/ui/mmg-fields.h
./src/ui/mmg-lcd-number.h
./src/ui/mmg-midi-buttons.h
./src/ui/mmg-list-widget.h
./src/ui/mmg-number-display.h
./src/ui/mmg-string-display.h
./src/ui/mmg-message-display.h
./src/ui/mmg-action-display.h
./src/ui/mmg-binding-display.h
./src/ui/mmg-manager-display.h
./src/ui/mmg-echo-window.h)

target_sources(${CMAKE_PROJECT_NAME} PRIVATE ./src/ui/resources.qrc)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Announcement
**The new version 3.0.0 Beta is now available! Go check out all of the new features.**<br><br><br>
**The new version 3.0.0 Beta 2 is now available! Go check out all of the new features.**<br><br><br>

# obs-midi-mg

Expand Down
2 changes: 1 addition & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"email": "[email protected]",
"website": "https://github.com/nhielost/obs-midi-mg",
"uuids": {
"windowsApp": "DE01A141-BB0F-488A-B195-839997257E65"
"windowsApp": "4B306DCD-DA45-4F74-BE41-B66947BA118A"
}
}
43 changes: 28 additions & 15 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ Actions.VideoSources.Sub.Output.Screenshot="Screenshot Taken"
Actions.VideoSources.Sub.Output.Custom="Custom Source Settings Changed"

Actions.AudioSources.AudioSource="Audio Source"
Actions.AudioSources.Volume="Volume (dB)"
Actions.AudioSources.Volume="Volume"
Actions.AudioSources.Format="Volume Format"
Actions.AudioSources.Format.Percent="Percentage (%)"
Actions.AudioSources.Format.Decibels="Decibels (dB)"
Actions.AudioSources.Sub.Input.ChangeVolume="Change Source Volume"
Actions.AudioSources.Sub.Input.IncrementVolume="Increment Source Volume"
Actions.AudioSources.Sub.Input.Mute="Mute Source"
Expand Down Expand Up @@ -188,12 +191,20 @@ Actions.MIDI.Sub.Output.Message="Messages Sent to Devices"

Binding.Name="Binding"
Binding.Untitled="Untitled Binding"
Binding.Selected="%1 selected"
Binding.Names="Bindings"
Binding.Reset="Action Reset Mode"
Binding.Reset.Triggered="Reset when reactivated"
Binding.Reset.Continuous="Never reset"
Binding.Input="Input Binding"
Binding.Output="Output Binding"

Collection.Name="Collection"
Collection.Untitled="Untitled Collection"

Device.Name="Device"
Device.Dummy="Restricted Device"
Device.Thru.Label="Send Through Incoming Messages"
Device.Check.Label="Check MIDI Device Capabilities..."
Device.Status.Input="Input Status"
Device.Status.Output="Output Status"
Device.Status.Connected="Connected"
Expand Down Expand Up @@ -255,10 +266,13 @@ StringDisplay.UpperBound="Upper Bound (corresponds to MIDI value of the number o
StringDisplay.LowerToggle="On State (will be used first)"
StringDisplay.UpperToggle="Off State (will be used after On State)"

UI.Buttons.Create="Add"
UI.Buttons.Copy="Copy"
UI.Buttons.Delete="Delete"
UI.Buttons.Bindings="Bindings"
UI.Buttons.New="New..."
UI.Buttons.Copy="Duplicate..."
UI.Buttons.Move="Move Binding to..."
UI.Buttons.Delete="Delete..."
UI.Buttons.Enable="Enable Binding..."
UI.Buttons.Switch="Change Binding Type..."
UI.Buttons.Collections="Binding Collections"
UI.Buttons.Devices="Devices"
UI.Buttons.Messages="Messages"
UI.Buttons.Actions="Actions"
Expand All @@ -267,23 +281,22 @@ UI.Buttons.Export="Export"
UI.Buttons.Import="Import"
UI.Buttons.Help="Help"
UI.Buttons.BugReport="Report a Bug"
UI.Buttons.Confirm="Confirm"
UI.Buttons.Edit="Edit"
UI.MessageOptions.ToggleNote="Toggle Note On / Off Messages"
UI.MessageOptions.ToggleVelocity="Toggle Velocity"
UI.Buttons.Confirm="Save Changes..."
UI.MessageBox.Title.PermanentRemove="Delete Confirmation"
UI.MessageBox.Text.PermanentRemove="This operation cannot be undone. Are you sure you want to do this?"
UI.MessageBox.Title.ActionSwitch="Change Action Type"
UI.MessageBox.Text.ActionSwitch="Switching action types will clear all existing action data. Are you sure you want to do this?"
UI.MessageBox.Title.BindingSwitch="Change Binding Type"
UI.MessageBox.Text.BindingSwitch="Switching binding types will clear all existing binding data. Are you sure you want to do this?"
UI.MessageBox.Title.FieldsError="Custom Setup Error"
UI.MessageBox.Text.FieldsError="The custom fields menu could not be displayed.\n\nThe source is invalid or does not exist."
UI.MessageBox.Title.PortOpenError="MIDI Device Port Error"
UI.MessageBox.Text.PortOpenError="This MIDI port could not be opened. Check the log file for more details."
UI.MessageBox.Title.DeviceRemove="MIDI Device Removal"
UI.MessageBox.Text.DeviceRemove="This MIDI device will be removed from this list. Are you sure you want to do this?"
UI.MessageBox.Title.DeviceCheck="MIDI Device Capability Check"
UI.MessageBox.Text.DeviceCheck="Capabilities checked successfully."
UI.Filesystem.ExportTitle="Save Bindings..."
UI.Filesystem.ImportTitle="Open Configuration File..."
UI.Filesystem.FileType="JSON Files (*.json)"
UI.Listen.Once="Listen Once..."
UI.Listen.Continuous="Listen Continuous..."
UI.Listen.Cancel="Cancel..."
UI.Select="Select %1s"
UI.SelectionNotice="Click to select an item. To select multiple items, press Ctrl or Shift when clicking an item.\n\nItems selected towards the top have the highest priority. Dragging an item around adjusts this priority."
UI.Listen.Cancel="Cancel..."
2 changes: 1 addition & 1 deletion libremidi
11 changes: 8 additions & 3 deletions src/actions/mmg-action-audio-sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ MMGActionAudioSources::MMGActionAudioSources(MMGActionManager *parent, const QJs
blog(LOG_DEBUG, "Action created.");
}

const QStringList MMGActionAudioSources::subNames() const
{
return subModuleTextList(
{"ChangeVolume", "IncrementVolume", "Mute", "Unmute", "ToggleMute", "AudioOffset", "AudioMonitor"});
}

void MMGActionAudioSources::json(QJsonObject &json_obj) const
{
MMGAction::json(json_obj);
Expand Down Expand Up @@ -96,8 +102,7 @@ void MMGActionAudioSources::createDisplay(QWidget *parent)

void MMGActionAudioSources::setComboOptions(QComboBox *sub)
{
sub->addItems(subModuleTextList(
{"ChangeVolume", "IncrementVolume", "Mute", "Unmute", "ToggleMute", "AudioOffset", "AudioMonitor"}));
MMGAction::setComboOptions(sub);
if (type() == TYPE_OUTPUT) enable_combo_option(sub, 1, false);
}

Expand Down Expand Up @@ -243,7 +248,7 @@ void MMGActionAudioSources::execute(const MMGMessage *midi) const
util_value /= 100.0;
util_value += obs_source_get_volume(obs_source);
} else {
util_value = convertDecibels(
util_value = convertDecibels(
convertDecibels(obs_source_get_volume(obs_source), true) + util_value, false);
}
obs_source_set_volume(obs_source, util_value);
Expand Down
1 change: 1 addition & 0 deletions src/actions/mmg-action-audio-sources.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class MMGActionAudioSources : public MMGAction {

Category category() const override { return MMGACTION_SOURCE_AUDIO; };
const QString trName() const override { return "AudioSources"; };
const QStringList subNames() const override;

void json(QJsonObject &json_obj) const override;
void copy(MMGAction *dest) const override;
Expand Down
38 changes: 18 additions & 20 deletions src/actions/mmg-action-collections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ MMGActionCollections::MMGActionCollections(MMGActionManager *parent, const QJson
blog(LOG_DEBUG, "Action created.");
}

const QStringList MMGActionCollections::subNames() const
{
QStringList opts;

switch (type()) {
case TYPE_INPUT:
default:
opts << subModuleText("Switch");
break;

case TYPE_OUTPUT:
opts << subModuleTextList({"Changing", "Changed", "Toggle"});
break;
}

return opts;
}

void MMGActionCollections::json(QJsonObject &json_obj) const
{
MMGAction::json(json_obj);
Expand Down Expand Up @@ -61,26 +79,6 @@ void MMGActionCollections::createDisplay(QWidget *parent)
collection_display->setDisplayMode(MMGStringDisplay::MODE_NORMAL);
}

void MMGActionCollections::setComboOptions(QComboBox *sub)
{
QStringList opts;

switch (type()) {
case TYPE_INPUT:
opts << subModuleText("Switch");
break;

case TYPE_OUTPUT:
opts << subModuleTextList({"Changing", "Changed", "Toggle"});
break;

default:
break;
}

sub->addItems(opts);
}

void MMGActionCollections::setActionParams()
{
MMGStringDisplay *collection_display = display()->stringDisplays()->fieldAt(0);
Expand Down
2 changes: 1 addition & 1 deletion src/actions/mmg-action-collections.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class MMGActionCollections : public MMGAction {

Category category() const override { return MMGACTION_COLLECTION; };
const QString trName() const override { return "Collections"; };
const QStringList subNames() const override;

void json(QJsonObject &json_obj) const override;
void copy(MMGAction *dest) const override;
void setEditable(bool edit) override;
void toggle() override;

void createDisplay(QWidget *parent) override;
void setComboOptions(QComboBox *sub) override;
void setActionParams() override;

void execute(const MMGMessage *midi) const override;
Expand Down
10 changes: 5 additions & 5 deletions src/actions/mmg-action-filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ MMGActionFilters::MMGActionFilters(MMGActionManager *parent, const QJsonObject &
blog(LOG_DEBUG, "Action created.");
}

const QStringList MMGActionFilters::subNames() const
{
return subModuleTextList({"Show", "Hide", "ToggleDisplay", "Reorder", "Custom"});
}

void MMGActionFilters::json(QJsonObject &json_obj) const
{
MMGAction::json(json_obj);
Expand Down Expand Up @@ -84,11 +89,6 @@ void MMGActionFilters::createDisplay(QWidget *parent)
display()->numberDisplays()->addNew(&num);
}

void MMGActionFilters::setComboOptions(QComboBox *sub)
{
sub->addItems(subModuleTextList({"Show", "Hide", "ToggleDisplay", "Reorder", "Custom"}));
}

void MMGActionFilters::setActionParams()
{
display()->stringDisplays()->hideAll();
Expand Down
2 changes: 1 addition & 1 deletion src/actions/mmg-action-filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class MMGActionFilters : public MMGAction {

Category category() const override { return MMGACTION_FILTER; };
const QString trName() const override { return "Filters"; };
const QStringList subNames() const override;

void json(QJsonObject &json_obj) const override;
void copy(MMGAction *dest) const override;
void setEditable(bool edit) override;
void toggle() override;

void createDisplay(QWidget *parent) override;
void setComboOptions(QComboBox *sub) override;
void setActionParams() override;

void execute(const MMGMessage *midi) const override;
Expand Down
5 changes: 0 additions & 5 deletions src/actions/mmg-action-hotkeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ void MMGActionHotkeys::createDisplay(QWidget *parent)
hotkey_display->setDisplayMode(MMGStringDisplay::MODE_NORMAL);
}

void MMGActionHotkeys::setComboOptions(QComboBox *sub)
{
sub->addItem(subModuleText("Activate"));
}

void MMGActionHotkeys::setActionParams()
{
display()->stringDisplays()->hideAll();
Expand Down
2 changes: 1 addition & 1 deletion src/actions/mmg-action-hotkeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class MMGActionHotkeys : public MMGAction {

Category category() const override { return MMGACTION_HOTKEY; };
const QString trName() const override { return "Hotkeys"; };
const QStringList subNames() const override { return {subModuleText("Activate")}; };

void json(QJsonObject &json_obj) const override;
void copy(MMGAction *dest) const override;
void setEditable(bool edit) override;
void toggle() override;

void createDisplay(QWidget *parent) override;
void setComboOptions(QComboBox *sub) override;
void setActionParams() override;

void execute(const MMGMessage *) const override;
Expand Down
46 changes: 22 additions & 24 deletions src/actions/mmg-action-media-sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ MMGActionMediaSources::MMGActionMediaSources(MMGActionManager *parent, const QJs
blog(LOG_DEBUG, "Action created.");
}

const QStringList MMGActionMediaSources::subNames() const
{
QStringList opts;

switch (type()) {
case TYPE_INPUT:
default:
opts << subModuleText("PlayPause")
<< obstr_all("ContextBar.MediaControls", {"RestartMedia", "StopMedia"})
<< subModuleText("SetTime")
<< obstr_all("ContextBar.MediaControls", {"PlaylistNext", "PlaylistPrevious"});
break;

case TYPE_OUTPUT:
opts << subModuleTextList({"Played", "Paused", "Restarted", "Stopped"});
break;
}

opts << subModuleTextList({"SkipForward", "SkipBackward"});
return opts;
}

void MMGActionMediaSources::json(QJsonObject &json_obj) const
{
MMGAction::json(json_obj);
Expand Down Expand Up @@ -62,30 +84,6 @@ void MMGActionMediaSources::createDisplay(QWidget *parent)
display()->numberDisplays()->addNew(&num);
}

void MMGActionMediaSources::setComboOptions(QComboBox *sub)
{
QStringList opts;

switch (type()) {
case TYPE_INPUT:
opts << subModuleText("PlayPause")
<< obstr_all("ContextBar.MediaControls", {"RestartMedia", "StopMedia"})
<< subModuleText("SetTime")
<< obstr_all("ContextBar.MediaControls", {"PlaylistNext", "PlaylistPrevious"});
break;

case TYPE_OUTPUT:
opts << subModuleTextList({"Played", "Paused", "Restarted", "Stopped"});
break;

default:
break;
}

opts << subModuleTextList({"SkipForward", "SkipBackward"});
sub->addItems(opts);
}

void MMGActionMediaSources::setActionParams()
{
MMGStringDisplay *source_display = display()->stringDisplays()->fieldAt(0);
Expand Down
2 changes: 1 addition & 1 deletion src/actions/mmg-action-media-sources.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class MMGActionMediaSources : public MMGAction {

Category category() const override { return MMGACTION_SOURCE_MEDIA; };
const QString trName() const override { return "MediaSources"; };
const QStringList subNames() const override;

void json(QJsonObject &json_obj) const override;
void copy(MMGAction *dest) const override;
void setEditable(bool edit) override;

void createDisplay(QWidget *parent) override;
void setComboOptions(QComboBox *sub) override;
void setActionParams() override;

void execute(const MMGMessage *midi) const override;
Expand Down
Loading

0 comments on commit d0a2c03

Please sign in to comment.