@@ -126,17 +126,7 @@ MainWindow::MainWindow(QString exepath, bool statupInTray, bool allowMultipleIns
126126 menu->addAction (tr (" What's this..." ), this ,[](){QWhatsThis::enterWhatsThisMode ();});
127127
128128 ui->toolButton ->setMenu (menu);
129- QMenu *menuC = new QMenu ();
130- menuC->addAction (tr (" Slight" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Slight" )); ColmPresetSelectionUpdated ();});
131- menuC->addAction (tr (" Level 1" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 1" )); ColmPresetSelectionUpdated ();});
132- menuC->addAction (tr (" Level 2" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 2" )); ColmPresetSelectionUpdated ();});
133- menuC->addAction (tr (" Level 3" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 3" )); ColmPresetSelectionUpdated ();});
134- menuC->addAction (tr (" Level 4" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 4" )); ColmPresetSelectionUpdated ();});
135- menuC->addAction (tr (" Level 5" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 5" )); ColmPresetSelectionUpdated ();});
136- menuC->addAction (tr (" Level 6" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 6" )); ColmPresetSelectionUpdated ();});
137- menuC->addAction (tr (" Level 7" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Level 7" )); ColmPresetSelectionUpdated ();});
138- menuC->addAction (tr (" Extreme" ), this ,[this ](){ ui->colmpreset ->setText (tr (" Extreme" )); ColmPresetSelectionUpdated ();});
139- ui->colmpreset ->setMenu (menuC);
129+
140130 m_stylehelper->SetStyle ();
141131 ui->eq_widget ->setAccentColor (palette ().highlight ().color ());
142132
@@ -622,12 +612,8 @@ QMenu* MainWindow::buildAvailableActions()
622612 if (preset == " Unknown" ) continue ;
623613 QAction *newEntry = new QAction (preset);
624614 connect (newEntry,&QAction::triggered,this ,[=](){
625- const auto data = PresetProvider::Colm::lookupPreset (preset);
626- lockapply=true ;
627- ui->colmwide ->setValueA (data.begin ()[0 ]);
628- ui->colmdepth ->setValueA (data.begin ()[1 ]);
629- lockapply=false ;
630- OnUpdate (true );
615+ ui->colmpreset ->setCurrentText (preset);
616+ ColmPresetSelectionUpdated ();
631617 });
632618 colmMenu->addAction (newEntry);
633619 }
@@ -946,6 +932,7 @@ void MainWindow::LoadConfig(Context ctx){
946932 if (ctx != Context::DBus){
947933 UpdateEqStringFromWidget ();
948934 UpdateDynsysStringFromWidget ();
935+ UpdateColmStringFromWidget ();
949936 }
950937 UpdateAllUnitLabels ();
951938
@@ -1086,8 +1073,11 @@ void MainWindow::DynsysPresetSelectionUpdated(){
10861073 OnUpdate (true );
10871074}
10881075void MainWindow::ColmPresetSelectionUpdated (){
1089- QString selection = ui->colmpreset ->text ();
1090- const auto data = PresetProvider::Colm::lookupPreset (selection);
1076+ if (ui->colmpreset ->currentText () == " ..." )
1077+ return ;
1078+ const auto data = PresetProvider::Colm::lookupPreset (ui->colmpreset ->currentText ());
1079+ if (data.size () <= 1 )
1080+ return ;
10911081 lockapply=true ;
10921082 ui->colmwide ->setValueA (data.begin ()[0 ]);
10931083 ui->colmdepth ->setValueA (data.begin ()[1 ]);
@@ -1273,6 +1263,11 @@ void MainWindow::UpdateDynsysStringFromWidget(){
12731263 ui->dyn_sidegain1 ->valueA (),ui->dyn_sidegain2 ->valueA ()});
12741264 ui->dynsys_preset ->setCurrentText (currentDynsysPresetName);
12751265}
1266+ void MainWindow::UpdateColmStringFromWidget (){
1267+ QString currentColmPresetName =
1268+ PresetProvider::Colm::reverseLookup ({ui->colmwide ->valueA (),ui->colmdepth ->valueA ()});
1269+ ui->colmpreset ->setCurrentText (currentColmPresetName);
1270+ }
12761271
12771272QVariantMap MainWindow::readConfig (){
12781273 QVariantMap confmap = ConfigIO::readFile (m_appwrapper->getPath ());
@@ -1322,6 +1317,9 @@ void MainWindow::ConnectActions(){
13221317 QList<QWidget*> registerDynsysUpdate (
13231318 {ui->dyn_xcoeff1 ,ui->dyn_xcoeff2 ,ui->dyn_ycoeff1 ,ui->dyn_ycoeff2 ,ui->dyn_sidegain1 ,ui->dyn_sidegain2 });
13241319
1320+ QList<QWidget*> registerColmUpdate (
1321+ {ui->colmwide ,ui->colmdepth });
1322+
13251323 foreach (QWidget* w, registerCurrentIndexChange)
13261324 connect (w, SIGNAL (currentIndexChanged (int )), this , SLOT (UpdateUnitLabel (int )));
13271325
@@ -1337,6 +1335,9 @@ void MainWindow::ConnectActions(){
13371335 foreach (QWidget* w, registerDynsysUpdate)
13381336 connect (w, SIGNAL (sliderReleased ()), this , SLOT (UpdateDynsysStringFromWidget ()));
13391337
1338+ foreach (QWidget* w, registerColmUpdate)
1339+ connect (w, SIGNAL (sliderReleased ()), this , SLOT (UpdateColmStringFromWidget ()));
1340+
13401341 connect (ui->apply , SIGNAL (clicked ()), this , SLOT (ApplyConfig ()));
13411342 connect (ui->disableFX , SIGNAL (clicked ()), this , SLOT (DisableFX ()));
13421343 connect (ui->reset_eq , SIGNAL (clicked ()), this , SLOT (ResetEQ ()));
@@ -1350,4 +1351,5 @@ void MainWindow::ConnectActions(){
13501351 connect (ui->dynsys_preset , SIGNAL (currentIndexChanged (int )), this , SLOT (DynsysPresetSelectionUpdated ()));
13511352 connect (ui->vbmode , SIGNAL (currentIndexChanged (int )), this , SLOT (OnRelease ()));
13521353 connect (ui->vcmode , SIGNAL (currentIndexChanged (int )), this , SLOT (OnRelease ()));
1354+ connect (ui->colmpreset , SIGNAL (currentIndexChanged (int )), this , SLOT (ColmPresetSelectionUpdated ()));
13531355}
0 commit comments