mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-19 23:13:53 -05:00
Double click on list item in run and sequence action to edit
This commit is contained in:
@@ -50,6 +50,7 @@ private slots:
|
||||
void RemoveArg();
|
||||
void ArgUp();
|
||||
void ArgDown();
|
||||
void ArgItemClicked(QListWidgetItem *);
|
||||
signals:
|
||||
void HeaderInfoChanged(const QString &);
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ private slots:
|
||||
void Remove();
|
||||
void Up();
|
||||
void Down();
|
||||
void MacroItemClicked(QListWidgetItem *);
|
||||
void ContinueFromClicked();
|
||||
void RestartChanged(int state);
|
||||
void UpdateStatusLine();
|
||||
|
||||
@@ -107,8 +107,6 @@ MacroActionRandomEdit::MacroActionRandomEdit(
|
||||
|
||||
QWidget::connect(_add, SIGNAL(clicked()), this, SLOT(AddMacro()));
|
||||
QWidget::connect(_remove, SIGNAL(clicked()), this, SLOT(RemoveMacro()));
|
||||
QWidget::connect(_macroList, SIGNAL(currentRowChanged(int)), this,
|
||||
SLOT(MacroSelectionChanged(int)));
|
||||
QWidget::connect(window(),
|
||||
SIGNAL(MacroRenamed(const QString &, const QString &)),
|
||||
this,
|
||||
|
||||
@@ -102,6 +102,8 @@ MacroActionRunEdit::MacroActionRunEdit(
|
||||
SLOT(RemoveArg()));
|
||||
QWidget::connect(_argUp, SIGNAL(clicked()), this, SLOT(ArgUp()));
|
||||
QWidget::connect(_argDown, SIGNAL(clicked()), this, SLOT(ArgDown()));
|
||||
connect(_argList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this,
|
||||
SLOT(ArgItemClicked(QListWidgetItem *)));
|
||||
|
||||
auto *entryLayout = new QHBoxLayout;
|
||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||
@@ -235,6 +237,33 @@ void MacroActionRunEdit::ArgDown()
|
||||
}
|
||||
}
|
||||
|
||||
void MacroActionRunEdit::ArgItemClicked(QListWidgetItem *item)
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string name;
|
||||
bool accepted = AdvSSNameDialog::AskForName(
|
||||
this,
|
||||
obs_module_text("AdvSceneSwitcher.action.run.addArgument"),
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.action.run.addArgumentDescription"),
|
||||
name, item->text(), 170, false);
|
||||
|
||||
if (!accepted || name.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto arg = QString::fromStdString(name);
|
||||
QVariant v = QVariant::fromValue(arg);
|
||||
item->setText(arg);
|
||||
item->setData(Qt::UserRole, arg);
|
||||
int idx = _argList->currentRow();
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_args[idx] = arg;
|
||||
}
|
||||
|
||||
void MacroActionRunEdit::SetArgListSize()
|
||||
{
|
||||
setHeightToContentHeight(_argList);
|
||||
|
||||
@@ -141,8 +141,10 @@ MacroActionSequenceEdit::MacroActionSequenceEdit(
|
||||
QWidget::connect(_down, SIGNAL(clicked()), this, SLOT(Down()));
|
||||
QWidget::connect(_continueFrom, SIGNAL(clicked()), this,
|
||||
SLOT(ContinueFromClicked()));
|
||||
QWidget::connect(_macroList, SIGNAL(currentRowChanged(int)), this,
|
||||
SLOT(MacroSelectionChanged(int)));
|
||||
QWidget::connect(_macroList,
|
||||
SIGNAL(itemDoubleClicked(QListWidgetItem *)), this,
|
||||
SLOT(MacroItemClicked(QListWidgetItem *)));
|
||||
|
||||
QWidget::connect(window(),
|
||||
SIGNAL(MacroRenamed(const QString &, const QString &)),
|
||||
this,
|
||||
@@ -312,6 +314,32 @@ void MacroActionSequenceEdit::Down()
|
||||
}
|
||||
}
|
||||
|
||||
void MacroActionSequenceEdit::MacroItemClicked(QListWidgetItem *item)
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string macroName;
|
||||
bool accepted = MacroSelectionDialog::AskForMacro(this, macroName);
|
||||
|
||||
if (!accepted || macroName.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MacroRef macro(macroName);
|
||||
|
||||
if (!macro.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
item->setText(QString::fromStdString(macroName));
|
||||
int idx = _macroList->currentRow();
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->_macros[idx] = macro;
|
||||
SetMacroListSize();
|
||||
}
|
||||
|
||||
void MacroActionSequenceEdit::ContinueFromClicked()
|
||||
{
|
||||
if (_loading || !_entryData) {
|
||||
|
||||
Reference in New Issue
Block a user