Advertisement
neo01124

dlgprefkey.cpp

Aug 20th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 21.37 KB | None | 0 0
  1. /***************************************************************************
  2.                           dlgprefkey.cpp  -  description
  3.                              -------------------
  4.     begin                : Thu Jun 7 2012
  5.     copyright            : (C) 2012 by Keith Salisbury
  6.     email                : keithsalisbury@gmail.com
  7. ***************************************************************************/
  8.  
  9. /***************************************************************************
  10. *                                                                         *
  11. *   This program is free software; you can redistribute it and/or modify  *
  12. *   it under the terms of the GNU General Public License as published by  *
  13. *   the Free Software Foundation; either version 2 of the License, or     *
  14. *   (at your option) any later version.                                   *
  15. *                                                                         *
  16. ***************************************************************************/
  17.  
  18. #include <qlineedit.h>
  19. #include <qfiledialog.h>
  20. #include <qwidget.h>
  21. #include <qspinbox.h>
  22. #include <qcheckbox.h>
  23. #include <qlabel.h>
  24. #include <qstring.h>
  25. #include <qpushbutton.h>
  26. #include <QtCore>
  27. #include <QMessageBox>
  28. #include "track/key_preferences.h"
  29.  
  30. #include "dlgprefkey.h"
  31. #include "xmlparse.h"
  32. #include "controlobject.h"
  33. //#include "dlgprefbeats.h"
  34. #include "vamp/vampanalyser.h"
  35.  
  36. using Vamp::Plugin;
  37. using Vamp::PluginHostAdapter;
  38. using Vamp::HostExt::PluginLoader;
  39. using Vamp::HostExt::PluginWrapper;
  40. using Vamp::HostExt::PluginInputDomainAdapter;
  41.  
  42.  
  43. #define CONFIG_KEY "[KEY]"
  44. bool firs = true;
  45. DlgPrefKey::DlgPrefKey(QWidget * parent,
  46.                        ConfigObject<ConfigValue> * _config) : QWidget(parent),m_pconfig(_config)
  47.   //Ui::DlgPrefKey()
  48. {
  49.     //config = _config;
  50.     //m_pconfig = _config;
  51.     setupUi(this);
  52.     //m_selectedAnalyser = "qm-tempotracker:0";
  53.     //setupUi(this);
  54.  
  55.    // populate();
  56.     loadSettings();
  57.     //Connections
  58.   //  connect(plugincombo, SIGNAL(currentIndexChanged(int)),
  59.     //        this, SLOT(pluginSelected(int)));
  60.     connect(banalyserenabled, SIGNAL(stateChanged(int)),
  61.           this, SLOT(analyserEnabled(int)));
  62.     connect(bfastAnalysisEnabled, SIGNAL(stateChanged(int)),
  63.             this, SLOT(fastAnalysisEnabled(int)));
  64.     connect(bfirstLastEnabled, SIGNAL(stateChanged(int)),
  65.             this, SLOT(firstLastEnabled(int)));
  66.    // connect(reset, SIGNAL(clicked(bool)), this, SLOT(setDefaults()));
  67.  
  68.     connect(breanalyzeEnabled, SIGNAL(stateChanged(int)),
  69.             this, SLOT(reanalyzeEnabled(int)));
  70.  
  71.     connect(bskipRelevantEnabled, SIGNAL(stateChanged(int)),
  72.             this, SLOT(skipRelevantEnabled(int)));
  73.  
  74.     connect(b1, SIGNAL(valueChanged(char)),
  75.             this, SLOT(notationValueChanged1(char)));
  76.     connect(b2, SIGNAL(valueChanged(char)),
  77.             this, SLOT(notationValueChanged2(char)));
  78.     connect(b3, SIGNAL(valueChanged(char)),
  79.             this, SLOT(notationValueChanged3(char)));
  80.     connect(b4, SIGNAL(valueChanged(char)),
  81.             this, SLOT(notationValueChanged4(char)));
  82.     connect(b5, SIGNAL(valueChanged(char)),
  83.             this, SLOT(notationValueChanged5(char)));
  84.     connect(b6, SIGNAL(valueChanged(char)),
  85.             this, SLOT(notationValueChanged6(char)));
  86.     connect(b7, SIGNAL(valueChanged(char)),
  87.             this, SLOT(notationValueChanged7(char)));
  88.     connect(b8, SIGNAL(valueChanged(char)),
  89.             this, SLOT(notationValueChanged8(char)));
  90.     connect(b9, SIGNAL(valueChanged(char)),
  91.             this, SLOT(notationValueChanged9(char)));
  92.     connect(b10, SIGNAL(valueChanged(char)),
  93.             this, SLOT(notationValueChanged10(char)));
  94.     connect(b11, SIGNAL(valueChanged(char)),
  95.             this, SLOT(notationValueChanged11(char)));
  96.     connect(b12, SIGNAL(valueChanged(char)),
  97.             this, SLOT(notationValueChanged12(char)));
  98.     connect(b13, SIGNAL(valueChanged(char)),
  99.             this, SLOT(notationValueChanged13(char)));
  100.     connect(b14, SIGNAL(valueChanged(char)),
  101.             this, SLOT(notationValueChanged14(char)));
  102.     connect(b15, SIGNAL(valueChanged(char)),
  103.             this, SLOT(notationValueChanged15(char)));
  104.     connect(b16, SIGNAL(valueChanged(char)),
  105.             this, SLOT(notationValueChanged16(char)));
  106.     connect(b17, SIGNAL(valueChanged(char)),
  107.             this, SLOT(notationValueChanged17(char)));
  108.     connect(b18, SIGNAL(valueChanged(char)),
  109.             this, SLOT(notationValueChanged18(char)));
  110.     connect(b19, SIGNAL(valueChanged(char)),
  111.             this, SLOT(notationValueChanged19(char)));
  112.     connect(b20, SIGNAL(valueChanged(char)),
  113.             this, SLOT(notationValueChanged20(char)));
  114.     connect(b21, SIGNAL(valueChanged(char)),
  115.             this, SLOT(notationValueChanged21(char)));
  116.     connect(b22, SIGNAL(valueChanged(char)),
  117.             this, SLOT(notationValueChanged22(char)));
  118.     connect(b23, SIGNAL(valueChanged(char)),
  119.             this, SLOT(notationValueChanged23(char)));
  120.     connect(b24, SIGNAL(valueChanged(char)),
  121.             this, SLOT(notationValueChanged24(char)));
  122.  
  123.     // connect(txtMaxBpm, SIGNAL(valueChanged(int)),
  124.       //      this, SLOT(maxBpmRangeChanged(int)));
  125.  
  126.     //connect(bReanalyse,SIGNAL(stateChanged(int)),
  127.         //    this, SLOT(slotReanalyzeChanged(int)));
  128.  
  129. }
  130.  
  131. DlgPrefKey::~DlgPrefKey()
  132. {
  133. }
  134.  
  135. void DlgPrefKey::loadSettings(){
  136.     //if(m_pconfig->getValueString(
  137.       //  ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYSER_KEY_PLUGIN_ID))==QString("")) {
  138.         //setDefaults();
  139.            // Write to config file so AnalyzerBeats can get the data
  140.         //return;
  141.     //}
  142.  
  143.    // QString pluginid = m_pconfig->getValueString(
  144.      //   ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYSER_BEAT_PLUGIN_ID));
  145.     //m_selectedAnalyser = pluginid;
  146.  
  147.     m_banalyserEnabled = static_cast<bool>(m_pconfig->getValueString(
  148.         ConfigKey(KEY_CONFIG_KEY, KEY_DETECTION_ENABLED)).toInt());
  149.  
  150.     m_bfastAnalysisEnabled = static_cast<bool>(m_pconfig->getValueString(
  151.         ConfigKey(KEY_CONFIG_KEY, KEY_FAST_ANALYSIS)).toInt());
  152.  
  153.     m_bfirstLastEnabled = static_cast<bool>(m_pconfig->getValueString(
  154.         ConfigKey(KEY_CONFIG_KEY, KEY_FIRST_LAST)).toInt());
  155.  
  156.     m_breanalyzeEnabled =  static_cast<bool>(m_pconfig->getValueString(
  157.         ConfigKey(KEY_CONFIG_KEY, KEY_REANALYZE)).toInt());
  158.  
  159.     m_bskipRelevantEnabled = static_cast<bool>(m_pconfig->getValueString(
  160.         ConfigKey(KEY_CONFIG_KEY, KEY_SKIP_RELEVANT)).toInt());
  161.  
  162.     m_b1 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N1));
  163.     m_b2 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N2));
  164.     m_b3 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N3));
  165.     m_b4 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N4));
  166.     m_b5 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N5));
  167.     m_b6 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N6));
  168.     m_b7 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N7));
  169.     m_b8 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N8));
  170.     m_b9 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N9));
  171.     m_b10 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N10));
  172.     m_b11 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N11));
  173.     m_b12 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N12));
  174.     m_b13 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N13));
  175.     m_b14 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N14));
  176.     m_b15 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N15));
  177.     m_b16 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N16));
  178.     m_b17 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N17));
  179.     m_b18 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N18));
  180.     m_b19 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N19));
  181.     m_b20 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N20));
  182.     m_b21 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N21));
  183.     m_b22 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N22));
  184.     m_b23 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N23));
  185.     m_b24 = m_pconfig->getValueString(ConfigKey(KEY_CONFIG_KEY, KEY_N24));
  186.  
  187.     slotApply();
  188.   //  if (!m_listIdentifier.contains(pluginid)) {
  189.     //    setDefaults();
  190.     //}
  191.    // m_minBpm = m_pconfig->getValueString(ConfigKey(BPM_CONFIG_KEY, BPM_RANGE_START)).toInt();
  192.     //m_maxBpm = m_pconfig->getValueString(ConfigKey(BPM_CONFIG_KEY, BPM_RANGE_END)).toInt();
  193.  
  194.     slotUpdate();
  195. }
  196.  
  197. void DlgPrefKey::setDefaults() {
  198.     //if (!m_listIdentifier.contains("qm-tempotracker:0")) {
  199.       //  qDebug() << "DlgPrefBeats: qm-tempotracker Vamp plugin not found";
  200.         //return;
  201.     //}
  202.     //m_selectedAnalyser = "qm-tempotracker:0";
  203.     m_banalyserEnabled = false;
  204.     m_bfastAnalysisEnabled = false;
  205.     m_bfirstLastEnabled = false;
  206.     m_breanalyzeEnabled = false;
  207.     //m_FastAnalysisEnabled = false;
  208.     m_bskipRelevantEnabled = false;
  209.     m_b1 = 'C';
  210.     m_b2 = 'C#';
  211.     m_b3 = 'D';
  212.     m_b4 = 'D#';
  213.     m_b5 = 'E';
  214.     m_b6 = 'F';
  215.     m_b7 = 'F#';
  216.     m_b8 = 'G';
  217.     m_b9 = 'G#';
  218.     m_b10 = 'A';
  219.     m_b11 = 'A#';
  220.     m_b12 = 'B';
  221.     m_b13 = 'c';
  222.     m_b14 = 'c#';
  223.     m_b15 = 'd';
  224.     m_b16 = 'd#';
  225.     m_b17 = 'e';
  226.     m_b18 = 'f';
  227.     m_b19 = 'f#';
  228.     m_b20 = 'g';
  229.     m_b21 = 'g#';
  230.     m_b22 = 'a';
  231.     m_b23 = 'a#';
  232.     m_b24 = 'b';
  233.     //m_minBpm = 70;
  234.     //m_maxBpm = 140;
  235.     //slotApply();
  236.     slotUpdate();
  237. }
  238.  
  239. void  DlgPrefKey::analyserEnabled(int i){
  240.     m_banalyserEnabled = static_cast<bool>(i);
  241.     slotUpdate();
  242. }
  243.  
  244. void  DlgPrefKey::fastAnalysisEnabled(int i){
  245.     m_bfastAnalysisEnabled = static_cast<bool>(i);
  246.     slotUpdate();
  247. }
  248.  
  249. void DlgPrefKey::firstLastEnabled(int i){
  250.     m_bfirstLastEnabled = static_cast<bool>(i);
  251.     slotUpdate();
  252. }
  253.  
  254. void DlgPrefKey::reanalyzeEnabled(int i){
  255.     m_breanalyzeEnabled = static_cast<bool>(i);
  256.     slotUpdate();
  257. }
  258.  
  259. void DlgPrefKey::skipRelevantEnabled(int i){
  260.     m_bskipRelevantEnabled = static_cast<bool>(i);
  261.     qDebug()<<m_bskipRelevantEnabled;
  262.     slotUpdate();
  263.     }
  264.  
  265. void DlgPrefKey::notationValueChanged1(char i){
  266.     m_b1 = i;
  267.     qDebug()<<m_b1;
  268.     slotUpdate();
  269.     }
  270.  
  271. void DlgPrefKey::notationValueChanged2(char i){
  272.     m_b2 = i;
  273.     //qDebug()<<m_bskipRelevantEnabled;
  274.     slotUpdate();
  275.     }
  276.  
  277. void DlgPrefKey::notationValueChanged3(char i){
  278.     m_b3 = i;
  279.     //qDebug()<<m_bskipRelevantEnabled;
  280.     slotUpdate();
  281.     }
  282.  
  283. void DlgPrefKey::notationValueChanged4(char i){
  284.     m_b4 = i;
  285.     //qDebug()<<m_bskipRelevantEnabled;
  286.     slotUpdate();
  287.     }
  288. void DlgPrefKey::notationValueChanged5(char i){
  289.     m_b5 = i;
  290.     //qDebug()<<m_bskipRelevantEnabled;
  291.     slotUpdate();
  292.     }
  293.  
  294. void DlgPrefKey::notationValueChanged6(char i){
  295.     m_b6 = i;
  296.     //qDebug()<<m_bskipRelevantEnabled;
  297.     slotUpdate();
  298.     }
  299.  
  300. void DlgPrefKey::notationValueChanged7(char i){
  301.     m_b7 = i;
  302.     //qDebug()<<m_bskipRelevantEnabled;
  303.     slotUpdate();
  304.     }
  305.  
  306. void DlgPrefKey::notationValueChanged8(char i){
  307.     m_b8 = i;
  308.     //qDebug()<<m_bskipRelevantEnabled;
  309.     slotUpdate();
  310.     }
  311. void DlgPrefKey::notationValueChanged9(char i){
  312.     m_b9 = i;
  313.     //qDebug()<<m_bskipRelevantEnabled;
  314.     slotUpdate();
  315.     }
  316.  
  317. void DlgPrefKey::notationValueChanged10(char i){
  318.     m_b10 = i;
  319.     //qDebug()<<m_bskipRelevantEnabled;
  320.     slotUpdate();
  321.     }
  322.  
  323. void DlgPrefKey::notationValueChanged11(char i){
  324.     m_b11 = i;
  325.     //qDebug()<<m_bskipRelevantEnabled;
  326.     slotUpdate();
  327.     }
  328.  
  329. void DlgPrefKey::notationValueChanged12(char i){
  330.     m_b12 = i;
  331.     //qDebug()<<m_bskipRelevantEnabled;
  332.     slotUpdate();
  333.     }
  334. void DlgPrefKey::notationValueChanged13(char i){
  335.     m_b13 = i;
  336.     //qDebug()<<m_bskipRelevantEnabled;
  337.     slotUpdate();
  338.     }
  339.  
  340. void DlgPrefKey::notationValueChanged14(char i){
  341.     m_b14 = i;
  342.     //qDebug()<<m_bskipRelevantEnabled;
  343.     slotUpdate();
  344.     }
  345.  
  346. void DlgPrefKey::notationValueChanged15(char i){
  347.     m_b15 = i;
  348.     //qDebug()<<m_bskipRelevantEnabled;
  349.     slotUpdate();
  350.     }
  351.  
  352. void DlgPrefKey::notationValueChanged16(char i){
  353.     m_b16 = i;
  354.     //qDebug()<<m_bskipRelevantEnabled;
  355.     slotUpdate();
  356.     }
  357. void DlgPrefKey::notationValueChanged17(char i){
  358.     m_b17 = i;
  359.     //qDebug()<<m_bskipRelevantEnabled;
  360.     slotUpdate();
  361.     }
  362.  
  363. void DlgPrefKey::notationValueChanged18(char i){
  364.     m_b18 = i;
  365.     //qDebug()<<m_bskipRelevantEnabled;
  366.     slotUpdate();
  367.     }
  368.  
  369. void DlgPrefKey::notationValueChanged19(char i){
  370.     m_b19 = i;
  371.     //qDebug()<<m_bskipRelevantEnabled;
  372.     slotUpdate();
  373.     }
  374.  
  375. void DlgPrefKey::notationValueChanged20(char i){
  376.     m_b20 = i;
  377.     //qDebug()<<m_bskipRelevantEnabled;
  378.     slotUpdate();
  379.     }
  380. void DlgPrefKey::notationValueChanged21(char i){
  381.     m_b21 = i;
  382.     //qDebug()<<m_bskipRelevantEnabled;
  383.     slotUpdate();
  384.     }
  385.  
  386. void DlgPrefKey::notationValueChanged22(char i){
  387.     m_b22 = i;
  388.     //qDebug()<<m_bskipRelevantEnabled;
  389.     slotUpdate();
  390.     }
  391.  
  392. void DlgPrefKey::notationValueChanged23(char i){
  393.     m_b23 = i;
  394.     //qDebug()<<m_bskipRelevantEnabled;
  395.     slotUpdate();
  396.     }
  397.  
  398. void DlgPrefKey::notationValueChanged24(char i){
  399.     m_b24 = i;
  400.     //qDebug()<<m_bskipRelevantEnabled;
  401.     slotUpdate();
  402.     }
  403.  
  404.  
  405. void DlgPrefKey::slotApply()
  406. {
  407.     //int selected = m_listIdentifier.indexOf(m_selectedAnalyser);
  408.     //if (selected == -1)
  409.      //   return;
  410.  
  411.     //m_pconfig->set(ConfigKey(
  412.       //  VAMP_CONFIG_KEY, VAMP_ANALYSER_BEAT_LIBRARY), ConfigValue(m_listLibrary[selected]));
  413.     //m_pconfig->set(ConfigKey(
  414.       //  VAMP_CONFIG_KEY, VAMP_ANALYSER_BEAT_PLUGIN_ID), ConfigValue(m_selectedAnalyser));
  415.     m_pconfig->set(ConfigKey(
  416.         KEY_CONFIG_KEY, KEY_DETECTION_ENABLED), ConfigValue(m_banalyserEnabled ? 1 : 0));
  417.     m_pconfig->set(ConfigKey(
  418.         KEY_CONFIG_KEY, KEY_FAST_ANALYSIS), ConfigValue(m_bfastAnalysisEnabled ? 1 : 0));
  419.     m_pconfig->set(ConfigKey(
  420.         KEY_CONFIG_KEY, KEY_FIRST_LAST), ConfigValue(m_bfirstLastEnabled ? 1 : 0));
  421.     m_pconfig->set(ConfigKey(
  422.         KEY_CONFIG_KEY, KEY_REANALYZE), ConfigValue(m_breanalyzeEnabled ? 1 : 0));
  423.     m_pconfig->set(ConfigKey(
  424.         KEY_CONFIG_KEY, KEY_SKIP_RELEVANT), ConfigValue(m_bskipRelevantEnabled ? 1 : 0));
  425.  
  426.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N1), ConfigValue(m_b1));
  427.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N2), ConfigValue(m_b2));
  428.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N3), ConfigValue(m_b3));
  429.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N4), ConfigValue(m_b4));
  430.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N5), ConfigValue(m_b5));
  431.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N6), ConfigValue(m_b6));
  432.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N7), ConfigValue(m_b7));
  433.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N8), ConfigValue(m_b8));
  434.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N9), ConfigValue(m_b9));
  435.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N10), ConfigValue(m_b10));
  436.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N11), ConfigValue(m_b11));
  437.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N12), ConfigValue(m_b12));
  438.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N13), ConfigValue(m_b13));
  439.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N14), ConfigValue(m_b14));
  440.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N15), ConfigValue(m_b15));
  441.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N16), ConfigValue(m_b16));
  442.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N17), ConfigValue(m_b17));
  443.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N18), ConfigValue(m_b18));
  444.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N19), ConfigValue(m_b19));
  445.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N20), ConfigValue(m_b20));
  446.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N21), ConfigValue(m_b21));
  447.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N22), ConfigValue(m_b22));
  448.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N23), ConfigValue(m_b23));
  449.     m_pconfig->set(ConfigKey(KEY_CONFIG_KEY, KEY_N24), ConfigValue(m_b24));
  450.  
  451.     // m_pconfig->set(ConfigKey(
  452.      //   KEY_CONFIG_KEY, KEY_SKIP_RELEVANT), ConfigValue(1));
  453.     //  m_pconfig->set(ConfigKey(
  454.     //    BPM_CONFIG_KEY, BPM_FAST_ANALYSIS_ENABLED), ConfigValue(m_FastAnalysisEnabled ? 1 : 0));
  455.  
  456.     //m_pconfig->set(ConfigKey(BPM_CONFIG_KEY, BPM_RANGE_START), ConfigValue(m_minBpm));
  457.     //m_pconfig->set(ConfigKey(BPM_CONFIG_KEY, BPM_RANGE_END), ConfigValue(m_maxBpm));
  458.     m_pconfig->Save();
  459. }
  460.  
  461. void DlgPrefKey::slotUpdate()
  462. {
  463.     //bfixedtempo->setEnabled(m_banalyserEnabled);
  464.     //boffset->setEnabled((m_banalyserEnabled && m_bfixedtempoEnabled));
  465.     //plugincombo->setEnabled(m_banalyserEnabled);
  466.     banalyserenabled->setChecked(m_banalyserEnabled);
  467.     bfastAnalysisEnabled->setChecked(m_bfastAnalysisEnabled);
  468.     //txtMaxBpm->setEnabled(m_banalyserEnabled && m_bfixedtempoEnabled);
  469.     // txtMinBpm->setEnabled(m_banalyserEnabled && m_bfixedtempoEnabled);
  470.     bfirstLastEnabled->setChecked(m_bfirstLastEnabled);
  471.     breanalyzeEnabled->setChecked(m_breanalyzeEnabled);
  472.     bskipRelevantEnabled->setChecked(m_bskipRelevantEnabled);
  473.  
  474.     b1->setEnabled(1);
  475.     b2->setEnabled(1);
  476.     b3->setEnabled(1);
  477.     b4->setEnabled(1);
  478.     b5->setEnabled(1);
  479.     b6->setEnabled(1);
  480.     b7->setEnabled(1);
  481.     b8->setEnabled(1);
  482.     b9->setEnabled(1);
  483.     b10->setEnabled(1);
  484.     b11->setEnabled(1);
  485.     b12->setEnabled(1);
  486.     b13->setEnabled(1);
  487.     b14->setEnabled(1);
  488.     b15->setEnabled(1);
  489.     b16->setEnabled(1);
  490.     b17->setEnabled(1);
  491.     b18->setEnabled(1);
  492.     b19->setEnabled(1);
  493.     b20->setEnabled(1);
  494.     b21->setEnabled(1);
  495.     b22->setEnabled(1);
  496.     b23->setEnabled(1);
  497.     b24->setEnabled(1);
  498.  
  499.     slotApply();
  500.  
  501.  
  502.     //if(!m_banalyserEnabled)
  503.       //  return;
  504.  
  505.     //bfixedtempo->setChecked(m_bfixedtempoEnabled);
  506.     //boffset->setChecked(m_boffsetEnabled);
  507.     //bFastAnalysis->setChecked(m_FastAnalysisEnabled);
  508.  
  509.     //int comboselected = m_listIdentifier.indexOf(m_selectedAnalyser);
  510.     //if( comboselected==-1){
  511.       //  qDebug()<<"DlgPrefBeats: Plugin not found in slotUpdate()";
  512.         //return;
  513.     //}
  514.  
  515.     //plugincombo->setCurrentIndex(comboselected);
  516.     //txtMaxBpm->setValue(m_maxBpm);
  517.     //txtMinBpm->setValue(m_minBpm);
  518.     //bReanalyse->setChecked(m_bReanalyze);
  519. }
  520.  
  521. //void DlgPrefBeats::populate() {
  522.   //  VampAnalyser::initializePluginPaths();
  523. //    QString selectedAnalyser = m_selectedAnalyser;
  524. //    m_listIdentifier.clear();
  525. //    m_listName.clear();
  526. //    m_listLibrary.clear();
  527. //    disconnect(plugincombo, SIGNAL(currentIndexChanged(int)),
  528. //            this, SLOT(pluginSelected(int)));
  529. //    plugincombo->clear();
  530. //    plugincombo->setDuplicatesEnabled(false);
  531. //    connect(plugincombo, SIGNAL(currentIndexChanged(int)),
  532. //            this, SLOT(pluginSelected(int)));
  533. //    VampPluginLoader *loader = VampPluginLoader::getInstance();
  534. //    std::vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
  535. //    qDebug() << "VampPluginLoader::listPlugins() returned" << plugins.size() << "plugins";
  536. //    for (unsigned int iplugin=0; iplugin < plugins.size(); iplugin++) {
  537. //        Plugin *plugin = loader->loadPlugin(plugins[iplugin], 48000);
  538. //        //TODO: find a way to add beat trackers only
  539. //        if (plugin) {
  540. //            Plugin::OutputList outputs = plugin->getOutputDescriptors();
  541. //            for (unsigned int ioutput=0; ioutput < outputs.size(); ioutput++) {
  542. //                QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
  543. //                                            + QString::number(ioutput);
  544. //                QString displaynametext = QString::fromStdString(plugin->getName());
  545. //                qDebug() << "Plugin output displayname:" << displayname << displaynametext;
  546. //                bool goodones = ((displayname.contains("mixxxbpmdetection")||
  547. //                                  displayname.contains("qm-tempotracker:0"))||
  548. //                                 displayname.contains("beatroot:0")||
  549. //                                 displayname.contains("marsyas_ibt:0")||
  550. //                                 displayname.contains("aubiotempo:0")
  551. //                                 );
  552.  
  553. //                bool goodones = ((displaynametext.contains("Beat Track")));
  554.                 //validate and add rows to qcombobox
  555.  
  556. //                m_listVersion << QString::number(plugin->getPluginVersion());
  557. //                m_listMaker << QString::fromStdString(plugin->getMaker());
  558. //                m_listCopyright << QString::fromStdString(plugin->getCopyright());
  559. //                m_listOutput << QString::number(ioutput);
  560. //                m_listDescription << QString::fromStdString(outputs[ioutput].description);
  561.  
  562. //                if (goodones) {
  563. //                    m_listName << displaynametext;
  564. //                    QString pluginlibrary = QString::fromStdString(plugins[iplugin]).section(":",0,0);
  565. //                    m_listLibrary << pluginlibrary;
  566. //                    QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
  567. //                            + QString::number(ioutput);
  568. //                    m_listIdentifier << displayname;
  569. //                    plugincombo->addItem(displaynametext, displayname);
  570. //                }
  571. //            }
  572. //            delete plugin;
  573. //            plugin = 0;
  574. //        }
  575. //    }
  576. //    m_selectedAnalyser = selectedAnalyser;
  577. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement