Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
evelynnev committed Jan 28, 2025
1 parent 0ffdc58 commit 0d3128a
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 122 deletions.
2 changes: 2 additions & 0 deletions src/library/trackset/basetracksetfeature.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "library/trackset/basetracksetfeature.h"

#include "analyzer/analyzerscheduledtrack.h"
#include "library/trackset/smarties/dlggroupedsmartiesinfo.h"
#include "library/trackset/smarties/dlgsmartiesinfo.h"
#include "moc_basetracksetfeature.cpp"

BaseTrackSetFeature::BaseTrackSetFeature(
Expand Down
1 change: 1 addition & 0 deletions src/library/trackset/basetracksetfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class BaseTrackSetFeature : public LibraryFeature {
const QString& iconName);

void pasteChild(const QModelIndex& index) override;

signals:
void analyzeTracks(const QList<AnalyzerScheduledTrack>&);

Expand Down
276 changes: 155 additions & 121 deletions src/library/trackset/smarties/smartiesfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,9 @@ void SmartiesFeature::slotEditSmarties() {
"SlotEditSmarties -> smartiesID = "
<< smartiesId;
}
dlgSmartiesInfo infoDialog(this); // Pass this to provide the SmartiesFeature instance
dlgSmartiesInfo infoDialog(
this); // Pass this to provide the GroupedSmartiesFeature
// instance
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> [START] -> "
"[INIT DIALOG] -> INIT DIALOG ";
Expand All @@ -584,7 +586,7 @@ void SmartiesFeature::slotEditSmarties() {

// Connect the dataUpdated signal to update smartiesData when Apply is clicked
connect(&infoDialog,
&dlgSmartiesInfo::dataUpdated,
&dlgGroupedSmartiesInfo::dataUpdated,
this,
[this, &smartiesId](const QVariantList& updatedData) {
// emit setBlockerOff("update");
Expand Down Expand Up @@ -616,87 +618,108 @@ void SmartiesFeature::slotEditSmarties() {
emit updateSmartiesData(smartiesData);
});

connect(&infoDialog, &dlgSmartiesInfo::requestDeleteSmarties, this, [this, &smartiesId]() {
// emit setBlockerOff("delete");
if (sDebug) {
qDebug()
<< "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> [DELETE] "
"-> START Request DELETE Smarties smartiesId "
<< smartiesId;
}
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (!smartiesId.isValid()) {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[DELETE] -> Invalid SmartiesId. : "
<< smartiesId;
}
return;
} else {
slotFindPreviousSmarties();
auto smartiesJustAbove = m_prevSiblingSmarties;
slotDeleteSmarties();
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[DELETE] -> smarties is deleted -> new active "
"smarties.";
}
activateSmarties(smartiesJustAbove);
smartiesId = smartiesJustAbove;
smartiesData.clear();
m_smartiesTableModel.selectSmarties2QVL(smartiesId, smartiesData);
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
activateSmarties(smartiesId);
// emit setBlockerOff("delete");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[DELETE] -> END DELETE Smarties smartiesId "
<< smartiesId;
}
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
emit updateSmartiesData(smartiesData);
}
});
connect(&infoDialog,
&dlgGroupedSmartiesInfo::requestDeleteSmarties,
this,
[this, &smartiesId]() {
// emit setBlockerOff("delete");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[DELETE] "
"-> START Request DELETE Smarties "
"smartiesId "
<< smartiesId;
}
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (!smartiesId.isValid()) {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[DELETE] -> Invalid SmartiesId. : "
<< smartiesId;
}
return;
} else {
slotFindPreviousSmarties();
auto smartiesJustAbove = m_prevSiblingSmarties;
slotDeleteSmarties();
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[DELETE] -> smarties is deleted -> "
"new active "
"smarties.";
}
activateSmarties(smartiesJustAbove);
smartiesId = smartiesJustAbove;
smartiesData.clear();
m_smartiesTableModel.selectSmarties2QVL(
smartiesId, smartiesData);
m_lastRightClickedIndex =
indexFromSmartiesId(smartiesId);
activateSmarties(smartiesId);
// emit setBlockerOff("delete");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[DELETE] -> END DELETE Smarties "
"smartiesId "
<< smartiesId;
}
m_lastRightClickedIndex =
indexFromSmartiesId(smartiesId);
emit updateSmartiesData(smartiesData);
}
});

connect(&infoDialog, &dlgSmartiesInfo::requestNewSmarties, this, [this, &smartiesId]() {
// emit setBlockerOff("new");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> [NEW] "
"-> START Request NEW Smarties smartiesId "
<< smartiesId;
}
SmartiesId smartiesId =
SmartiesFeatureHelper(m_pTrackCollection, m_pConfig)
.createEmptySmartiesFromUI();
if (!smartiesId.isValid()) {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEW] -> Creation failed.";
}
return;
} else {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEW] -> New smarties created. smartiesId "
<< smartiesId;
}
}
activateSmarties(smartiesId);
smartiesData.clear();
m_smartiesTableModel.selectSmarties2QVL(smartiesId, smartiesData);
slotSmartiesTableChanged(smartiesId);
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> [NEW] "
"-> END Smarties created smartiesId "
<< smartiesId;
}
emit updateSmartiesData(smartiesData);
// emit setBlockerOff("new");
});
connect(&infoDialog,
&dlgGroupedSmartiesInfo::requestNewSmarties,
this,
[this, &smartiesId]() {
// emit setBlockerOff("new");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEW] "
"-> START Request NEW Smarties smartiesId "
<< smartiesId;
}
SmartiesId smartiesId =
SmartiesFeatureHelper(m_pTrackCollection, m_pConfig)
.createEmptySmartiesFromUI();
if (!smartiesId.isValid()) {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[NEW] -> Creation failed.";
}
return;
} else {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[NEW] -> New smarties created. "
"smartiesId "
<< smartiesId;
}
}
activateSmarties(smartiesId);
smartiesData.clear();
m_smartiesTableModel.selectSmarties2QVL(
smartiesId, smartiesData);
slotSmartiesTableChanged(smartiesId);
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEW] "
"-> END Smarties created smartiesId "
<< smartiesId;
}
emit updateSmartiesData(smartiesData);
// emit setBlockerOff("new");
});

connect(&infoDialog,
&dlgSmartiesInfo::requestPreviousSmarties,
&dlgGroupedSmartiesInfo::requestPreviousSmarties,
this,
[this, &smartiesId]() {
// emit setBlockerOff("previous");
Expand Down Expand Up @@ -746,47 +769,58 @@ void SmartiesFeature::slotEditSmarties() {
emit updateSmartiesData(smartiesData);
}
});
connect(&infoDialog, &dlgSmartiesInfo::requestNextSmarties, this, [this, &smartiesId]() {
// emit setBlockerOff("next");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> [NEXT] "
"-> START Request NEXT Smarties smartiesId "
<< smartiesId;
}
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (!smartiesId.isValid()) {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEXT] -> Invalid SmartiesId. : "
<< smartiesId;
}
return;
} else {
slotFindNextSmarties();
auto smartiesJustBelow = m_nextSiblingSmarties;
activateSmarties(smartiesJustBelow);
smartiesId = smartiesJustBelow;
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEXT] -> Next smarties ID"
<< m_nextSiblingSmarties;
}
smartiesData.clear();
m_smartiesTableModel.selectSmarties2QVL(smartiesId, smartiesData);
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEXT] -> Sibling Smarties loaded smartiesId."
<< smartiesId;
// emit setBlockerOff("next");
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEXT] -> END Sibling Smarties loaded "
"m_lastRightClickedIndex."
<< m_lastRightClickedIndex;
}
emit updateSmartiesData(smartiesData);
}
});
connect(&infoDialog,
&dlgGroupedSmartiesInfo::requestNextSmarties,
this,
[this, &smartiesId]() {
// emit setBlockerOff("next");
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT SMARTIES] -> "
"[NEXT] "
"-> START Request NEXT Smarties smartiesId "
<< smartiesId;
}
m_lastRightClickedIndex = indexFromSmartiesId(smartiesId);
if (!smartiesId.isValid()) {
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[NEXT] -> Invalid SmartiesId. : "
<< smartiesId;
}
return;
} else {
slotFindNextSmarties();
auto smartiesJustBelow = m_nextSiblingSmarties;
activateSmarties(smartiesJustBelow);
smartiesId = smartiesJustBelow;
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[NEXT] -> Next smarties ID"
<< m_nextSiblingSmarties;
}
smartiesData.clear();
m_smartiesTableModel.selectSmarties2QVL(
smartiesId, smartiesData);
m_lastRightClickedIndex =
indexFromSmartiesId(smartiesId);
if (sDebug) {
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[NEXT] -> Sibling Smarties loaded "
"smartiesId."
<< smartiesId;
// emit setBlockerOff("next");
qDebug() << "[SMARTIESFEATURE] [SLOT EDIT "
"SMARTIES] -> "
"[NEXT] -> END Sibling Smarties loaded "
"m_lastRightClickedIndex."
<< m_lastRightClickedIndex;
}
emit updateSmartiesData(smartiesData);
}
});

// Execute & close the dialog
if (infoDialog.exec() == QDialog::Accepted) {
Expand Down
1 change: 0 additions & 1 deletion src/library/trackset/smarties/smartiesfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class SmartiesFeature : public BaseTrackSetFeature {
private slots:
void slotDeleteSmarties();
void slotEditSmarties();

void slotRenameSmarties();
void slotDuplicateSmarties();
void slotToggleSmartiesLock();
Expand Down
1 change: 1 addition & 0 deletions src/library/trackset/smarties/smartiesfeaturehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QStringList>

#include "library/trackcollection.h"
#include "library/trackset/basetracksetfeature.h"
#include "library/trackset/smarties/smarties.h"
#include "library/trackset/smarties/smartiessummary.h"
#include "moc_smartiesfeaturehelper.cpp"
Expand Down
3 changes: 3 additions & 0 deletions src/library/trackset/smarties/smartiesfeaturehelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

#include <QObject>

#include "library/trackset/smarties/dlggroupedsmartiesinfo.h"
#include "library/trackset/smarties/dlgsmartiesinfo.h"
#include "library/trackset/smarties/smartiesid.h"
#include "preferences/usersettings.h"

class TrackCollection;
class Smarties;
class BaseTrackSetFeature;

class SmartiesFeatureHelper : public QObject {
Q_OBJECT
Expand Down

0 comments on commit 0d3128a

Please sign in to comment.