Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pluginlistrefreshdialog.cpp 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /*
  2. * Carla plugin host
  3. * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "pluginlistrefreshdialog.hpp"
  18. #ifdef __clang__
  19. # pragma clang diagnostic push
  20. # pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
  21. # pragma clang diagnostic ignored "-Wdeprecated-register"
  22. #elif defined(__GNUC__) && __GNUC__ >= 8
  23. # pragma GCC diagnostic push
  24. # pragma GCC diagnostic ignored "-Wclass-memaccess"
  25. # pragma GCC diagnostic ignored "-Wdeprecated-copy"
  26. #endif
  27. #include "ui_pluginlistrefreshdialog.h"
  28. #include <QtCore/QFileInfo>
  29. #include <QtWidgets/QPushButton>
  30. #ifdef __clang__
  31. # pragma clang diagnostic pop
  32. #elif defined(__GNUC__) && __GNUC__ >= 8
  33. # pragma GCC diagnostic pop
  34. #endif
  35. #include "qsafesettings.hpp"
  36. #include "CarlaFrontend.h"
  37. #include "CarlaUtils.h"
  38. #include <cstring>
  39. static bool hasFeature(const char* const* const features, const char* const feature)
  40. {
  41. if (features == nullptr)
  42. return false;
  43. for (int i=0; features[i] != nullptr; ++i)
  44. {
  45. if (std::strcmp(features[i], feature) == 0)
  46. return true;
  47. }
  48. return false;
  49. }
  50. // --------------------------------------------------------------------------------------------------------------------
  51. // Jack Application Dialog
  52. struct PluginListRefreshDialog::Self {
  53. Ui_PluginRefreshW ui;
  54. QPixmap fIconYes;
  55. QPixmap fIconNo;
  56. Self() {}
  57. static Self& create()
  58. {
  59. Self* const self = new Self();
  60. return *self;
  61. }
  62. };
  63. PluginListRefreshDialog::PluginListRefreshDialog(QWidget* const parent, const bool useSystemIcons)
  64. : QDialog(parent),
  65. self(Self::create())
  66. {
  67. self.ui.setupUi(this);
  68. // ----------------------------------------------------------------------------------------------------------------
  69. // Internal stuff
  70. #ifdef CARLA_OS_WIN
  71. #define APP_EXT ".exe"
  72. #else
  73. #define APP_EXT ""
  74. #endif
  75. QString hostPathBinaries;
  76. const bool hasNative = QFileInfo::exists(QCarlaString(hostPathBinaries) + CARLA_OS_SEP_STR "carla-discovery-native" APP_EXT);
  77. const bool hasPosix32 = QFileInfo::exists(QCarlaString(hostPathBinaries) + CARLA_OS_SEP_STR "carla-discovery-posix32");
  78. const bool hasPosix64 = QFileInfo::exists(QCarlaString(hostPathBinaries) + CARLA_OS_SEP_STR "carla-discovery-posix64");
  79. const bool hasWin32 = QFileInfo::exists(QCarlaString(hostPathBinaries) + CARLA_OS_SEP_STR "carla-discovery-win32.exe");
  80. const bool hasWin64 = QFileInfo::exists(QCarlaString(hostPathBinaries) + CARLA_OS_SEP_STR "carla-discovery-win64.exe");
  81. // self.fThread = SearchPluginsThread(self, host.pathBinaries)
  82. // ----------------------------------------------------------------------------------------------------------------
  83. // Set-up Icons
  84. if (useSystemIcons)
  85. {
  86. // self.ui.b_start->setIcon(getIcon("arrow-right", 16, "svgz"));
  87. // self.ui.b_close->setIcon(getIcon("window-close", 16, "svgz"));
  88. // if QT_VERSION >= 0x50600:
  89. // size = int(16 * self.devicePixelRatioF())
  90. // else:
  91. // size = 16
  92. // self.fIconYes = QPixmap(getIcon('dialog-ok-apply', 16, 'svgz').pixmap(size))
  93. // self.fIconNo = QPixmap(getIcon('dialog-error', 16, 'svgz').pixmap(size))
  94. }
  95. else
  96. {
  97. self.fIconYes = QPixmap(":/16x16/dialog-ok-apply.svgz");
  98. self.fIconNo = QPixmap(":/16x16/dialog-error.svgz");
  99. }
  100. // ----------------------------------------------------------------------------------------------------------------
  101. // UI setup
  102. // FIXME remove LRDF
  103. self.ui.ico_rdflib->setPixmap(self.fIconNo);
  104. self.ui.b_skip->hide();
  105. #if defined(CARLA_OS_HAIKU)
  106. self.ui.ch_posix32->setText("Haiku 32bit");
  107. self.ui.ch_posix64->setText("Haiku 64bit");
  108. #elif defined(CARLA_OS_LINUX)
  109. self.ui.ch_posix32->setText("Linux 32bit");
  110. self.ui.ch_posix64->setText("Linux 64bit");
  111. #elif defined(CARLA_OS_MAC)
  112. self.ui.ch_posix32->setText("MacOS 32bit");
  113. self.ui.ch_posix64->setText("MacOS 64bit");
  114. #endif
  115. #ifndef CARLA_OS_WIN
  116. if (hasPosix32)
  117. {
  118. self.ui.ico_posix32->setPixmap(self.fIconYes);
  119. }
  120. else
  121. #endif
  122. {
  123. self.ui.ico_posix32->setPixmap(self.fIconNo);
  124. self.ui.ch_posix32->setEnabled(false);
  125. }
  126. #ifndef CARLA_OS_WIN
  127. if (hasPosix64)
  128. {
  129. self.ui.ico_posix64->setPixmap(self.fIconYes);
  130. }
  131. else
  132. #endif
  133. {
  134. self.ui.ico_posix64->setPixmap(self.fIconNo);
  135. self.ui.ch_posix64->setEnabled(false);
  136. }
  137. if (hasWin32)
  138. {
  139. self.ui.ico_win32->setPixmap(self.fIconYes);
  140. }
  141. else
  142. {
  143. self.ui.ico_win32->setPixmap(self.fIconNo);
  144. self.ui.ch_win32->setEnabled(false);
  145. }
  146. if (hasWin64)
  147. {
  148. self.ui.ico_win64->setPixmap(self.fIconYes);
  149. }
  150. else
  151. {
  152. self.ui.ico_win64->setPixmap(self.fIconNo);
  153. self.ui.ch_win64->setEnabled(false);
  154. }
  155. bool hasNonNative;
  156. #if defined(CARLA_OS_WIN)
  157. #ifdef CARLA_OS_64BIT
  158. hasNonNative = hasWin32;
  159. self.ui.ch_win64->setEnabled(false);
  160. self.ui.ch_win64->setVisible(false);
  161. self.ui.ico_win64->setVisible(false);
  162. self.ui.label_win64->setVisible(false);
  163. #else
  164. hasNonNative = hasWin64;
  165. self.ui.ch_win32->setEnabled(false);
  166. self.ui.ch_win32->setVisible(false);
  167. self.ui.ico_win32->setVisible(false);
  168. self.ui.label_win32->setVisible(false);
  169. #endif
  170. self.ui.ch_posix32->setEnabled(false);
  171. self.ui.ch_posix32->setVisible(false);
  172. self.ui.ch_posix64->setEnabled(false);
  173. self.ui.ch_posix64->setVisible(false);
  174. self.ui.ico_posix32->hide();
  175. self.ui.ico_posix64->hide();
  176. self.ui.label_posix32->hide();
  177. self.ui.label_posix64->hide();
  178. self.ui.ico_rdflib->hide();
  179. self.ui.label_rdflib->hide();
  180. #elif defined(CARLA_OS_64BIT)
  181. hasNonNative = hasPosix32 || hasWin32 || hasWin64;
  182. self.ui.ch_posix64->setEnabled(false);
  183. self.ui.ch_posix64->setVisible(false);
  184. self.ui.ico_posix64->setVisible(false);
  185. self.ui.label_posix64->setVisible(false);
  186. #else
  187. hasNonNative = hasPosix64 || hasWin32 || hasWin64;
  188. self.ui.ch_posix32->setEnabled(false);
  189. self.ui.ch_posix32->setVisible(false);
  190. self.ui.ico_posix32->setVisible(false);
  191. self.ui.label_posix32->setVisible(false);
  192. #endif
  193. #ifdef CARLA_OS_MAC
  194. setWindowModality(Qt::WindowModal);
  195. #else
  196. self.ui.ch_au->setEnabled(false);
  197. self.ui.ch_au->setVisible(false);
  198. #endif
  199. if (hasNative)
  200. {
  201. self.ui.ico_native->setPixmap(self.fIconYes);
  202. }
  203. else
  204. {
  205. self.ui.ico_native->setPixmap(self.fIconNo);
  206. self.ui.ch_native->setEnabled(false);
  207. self.ui.ch_sf2->setEnabled(false);
  208. if (! hasNonNative)
  209. {
  210. self.ui.ch_ladspa->setEnabled(false);
  211. self.ui.ch_dssi->setEnabled(false);
  212. self.ui.ch_vst->setEnabled(false);
  213. self.ui.ch_vst3->setEnabled(false);
  214. self.ui.ch_clap->setEnabled(false);
  215. }
  216. }
  217. // TODO
  218. // if (! hasLoadedLv2Plugins)
  219. self.ui.lv2_restart_notice->hide();
  220. setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
  221. // ----------------------------------------------------------------------------------------------------------------
  222. // Load settings
  223. loadSettings();
  224. // ----------------------------------------------------------------------------------------------------------------
  225. // Hide bridges if disabled
  226. // TODO
  227. bool showPluginBridges = true;
  228. bool showWineBridges = true;
  229. #ifdef CARLA_OS_WIN
  230. #ifndef CARLA_OS_64BIT
  231. // NOTE: We Assume win32 carla build will not run win64 plugins
  232. showPluginBridges = false;
  233. #endif
  234. showWineBridges = false;
  235. #endif
  236. if (! showPluginBridges)
  237. {
  238. self.ui.ch_native->setChecked(true);
  239. self.ui.ch_native->setEnabled(false);
  240. self.ui.ch_native->setVisible(false);
  241. self.ui.ch_posix32->setChecked(false);
  242. self.ui.ch_posix32->setEnabled(false);
  243. self.ui.ch_posix32->setVisible(false);
  244. self.ui.ch_posix64->setChecked(false);
  245. self.ui.ch_posix64->setEnabled(false);
  246. self.ui.ch_posix64->setVisible(false);
  247. self.ui.ch_win32->setChecked(false);
  248. self.ui.ch_win32->setEnabled(false);
  249. self.ui.ch_win32->setVisible(false);
  250. self.ui.ch_win64->setChecked(false);
  251. self.ui.ch_win64->setEnabled(false);
  252. self.ui.ch_win64->setVisible(false);
  253. self.ui.ico_posix32->hide();
  254. self.ui.ico_posix64->hide();
  255. self.ui.ico_win32->hide();
  256. self.ui.ico_win64->hide();
  257. self.ui.label_posix32->hide();
  258. self.ui.label_posix64->hide();
  259. self.ui.label_win32->hide();
  260. self.ui.label_win64->hide();
  261. self.ui.sep_format->hide();
  262. }
  263. else if (! showWineBridges)
  264. {
  265. self.ui.ch_win32->setChecked(false);
  266. self.ui.ch_win32->setEnabled(false);
  267. self.ui.ch_win32->setVisible(false);
  268. self.ui.ch_win64->setChecked(false);
  269. self.ui.ch_win64->setEnabled(false);
  270. self.ui.ch_win64->setVisible(false);
  271. self.ui.ico_win32->hide();
  272. self.ui.ico_win64->hide();
  273. self.ui.label_win32->hide();
  274. self.ui.label_win64->hide();
  275. }
  276. // Disable non-supported features
  277. const char* const* const features = carla_get_supported_features();
  278. if (! hasFeature(features, "sf2"))
  279. {
  280. self.ui.ch_sf2->setChecked(false);
  281. self.ui.ch_sf2->setEnabled(false);
  282. }
  283. #ifdef CARLA_OS_MAC
  284. if (! hasFeature(features, "juce"))
  285. {
  286. self.ui.ch_au->setChecked(false);
  287. self.ui.ch_au->setEnabled(false);
  288. }
  289. #endif
  290. // ----------------------------------------------------------------------------------------------------------------
  291. // Resize to minimum size, as it's very likely UI stuff was hidden
  292. resize(minimumSize());
  293. // ----------------------------------------------------------------------------------------------------------------
  294. // Set-up connections
  295. connect(this, &QDialog::finished,
  296. this, &PluginListRefreshDialog::slot_saveSettings);
  297. // self.ui.b_start.clicked.connect(self.slot_start)
  298. // self.ui.b_skip.clicked.connect(self.slot_skip)
  299. // self.ui.ch_native.clicked.connect(self.slot_checkTools)
  300. // self.ui.ch_posix32.clicked.connect(self.slot_checkTools)
  301. // self.ui.ch_posix64.clicked.connect(self.slot_checkTools)
  302. // self.ui.ch_win32.clicked.connect(self.slot_checkTools)
  303. // self.ui.ch_win64.clicked.connect(self.slot_checkTools)
  304. // self.ui.ch_ladspa.clicked.connect(self.slot_checkTools)
  305. // self.ui.ch_dssi.clicked.connect(self.slot_checkTools)
  306. // self.ui.ch_lv2.clicked.connect(self.slot_checkTools)
  307. // self.ui.ch_vst.clicked.connect(self.slot_checkTools)
  308. // self.ui.ch_vst3.clicked.connect(self.slot_checkTools)
  309. // self.ui.ch_clap.clicked.connect(self.slot_checkTools)
  310. // self.ui.ch_au.clicked.connect(self.slot_checkTools)
  311. // self.ui.ch_sf2.clicked.connect(self.slot_checkTools)
  312. // self.ui.ch_sfz.clicked.connect(self.slot_checkTools)
  313. // self.ui.ch_jsfx.clicked.connect(self.slot_checkTools)
  314. // self.fThread.pluginLook.connect(self.slot_handlePluginLook)
  315. // self.fThread.finished.connect(self.slot_handlePluginThreadFinished)
  316. // connect(this, &QDialog::finished,
  317. // this, &JackAppDialog::slot_saveSettings);
  318. // connect(self.ui.cb_session_mgr, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  319. // this, &JackAppDialog::slot_sessionManagerChanged);
  320. // connect(self.ui.le_command, &QLineEdit::textChanged,
  321. // this, &JackAppDialog::slot_commandChanged);
  322. // ----------------------------------------------------------------------------------------------------------------
  323. // Post-connect setup
  324. slot_checkTools();
  325. }
  326. PluginListRefreshDialog::~PluginListRefreshDialog()
  327. {
  328. delete &self;
  329. }
  330. // -----------------------------------------------------------------------------------------------------------------
  331. // public methods
  332. // -----------------------------------------------------------------------------------------------------------------
  333. // protected methods
  334. void PluginListRefreshDialog::closeEvent(QCloseEvent* const event)
  335. {
  336. /*
  337. if (self.fThread.isRunning())
  338. {
  339. self.fThread.stop();
  340. killDiscovery();
  341. #self.fThread.terminate();
  342. self.fThread.wait();
  343. }
  344. if (self.fThread.hasSomethingChanged())
  345. accept();
  346. else
  347. */
  348. reject();
  349. QDialog::closeEvent(event);
  350. }
  351. // -----------------------------------------------------------------------------------------------------------------
  352. // private methods
  353. void PluginListRefreshDialog::loadSettings()
  354. {
  355. const QSafeSettings settings("falkTX", "CarlaRefresh2");
  356. bool check;
  357. check = settings.valueBool("PluginDatabase/SearchLADSPA", true) and self.ui.ch_ladspa->isEnabled();
  358. self.ui.ch_ladspa->setChecked(check);
  359. check = settings.valueBool("PluginDatabase/SearchDSSI", true) and self.ui.ch_dssi->isEnabled();
  360. self.ui.ch_dssi->setChecked(check);
  361. check = settings.valueBool("PluginDatabase/SearchLV2", true) and self.ui.ch_lv2->isEnabled();
  362. self.ui.ch_lv2->setChecked(check);
  363. check = settings.valueBool("PluginDatabase/SearchVST2", true) and self.ui.ch_vst->isEnabled();
  364. self.ui.ch_vst->setChecked(check);
  365. check = settings.valueBool("PluginDatabase/SearchVST3", true) and self.ui.ch_vst3->isEnabled();
  366. self.ui.ch_vst3->setChecked(check);
  367. check = settings.valueBool("PluginDatabase/SearchCLAP", true) and self.ui.ch_clap->isEnabled();
  368. self.ui.ch_clap->setChecked(check);
  369. #ifdef CARLA_OS_MAC
  370. check = settings.valueBool("PluginDatabase/SearchAU", true) and self.ui.ch_au->isEnabled();
  371. #else
  372. check = false;
  373. #endif
  374. self.ui.ch_au->setChecked(check);
  375. check = settings.valueBool("PluginDatabase/SearchSF2", false) and self.ui.ch_sf2->isEnabled();
  376. self.ui.ch_sf2->setChecked(check);
  377. check = settings.valueBool("PluginDatabase/SearchSFZ", false) and self.ui.ch_sfz->isEnabled();
  378. self.ui.ch_sfz->setChecked(check);
  379. check = settings.valueBool("PluginDatabase/SearchJSFX", true) and self.ui.ch_jsfx->isEnabled();
  380. self.ui.ch_jsfx->setChecked(check);
  381. check = settings.valueBool("PluginDatabase/SearchNative", true) and self.ui.ch_native->isEnabled();
  382. self.ui.ch_native->setChecked(check);
  383. check = settings.valueBool("PluginDatabase/SearchPOSIX32", false) and self.ui.ch_posix32->isEnabled();
  384. self.ui.ch_posix32->setChecked(check);
  385. check = settings.valueBool("PluginDatabase/SearchPOSIX64", false) and self.ui.ch_posix64->isEnabled();
  386. self.ui.ch_posix64->setChecked(check);
  387. check = settings.valueBool("PluginDatabase/SearchWin32", false) and self.ui.ch_win32->isEnabled();
  388. self.ui.ch_win32->setChecked(check);
  389. check = settings.valueBool("PluginDatabase/SearchWin64", false) and self.ui.ch_win64->isEnabled();
  390. self.ui.ch_win64->setChecked(check);
  391. self.ui.ch_do_checks->setChecked(settings.valueBool("PluginDatabase/DoChecks", false));
  392. }
  393. // -----------------------------------------------------------------------------------------------------------------
  394. // private slots
  395. void PluginListRefreshDialog::slot_saveSettings()
  396. {
  397. QSafeSettings settings("falkTX", "CarlaRefresh2");
  398. settings.setValue("PluginDatabase/SearchLADSPA", self.ui.ch_ladspa->isChecked());
  399. settings.setValue("PluginDatabase/SearchDSSI", self.ui.ch_dssi->isChecked());
  400. settings.setValue("PluginDatabase/SearchLV2", self.ui.ch_lv2->isChecked());
  401. settings.setValue("PluginDatabase/SearchVST2", self.ui.ch_vst->isChecked());
  402. settings.setValue("PluginDatabase/SearchVST3", self.ui.ch_vst3->isChecked());
  403. settings.setValue("PluginDatabase/SearchCLAP", self.ui.ch_clap->isChecked());
  404. settings.setValue("PluginDatabase/SearchAU", self.ui.ch_au->isChecked());
  405. settings.setValue("PluginDatabase/SearchSF2", self.ui.ch_sf2->isChecked());
  406. settings.setValue("PluginDatabase/SearchSFZ", self.ui.ch_sfz->isChecked());
  407. settings.setValue("PluginDatabase/SearchJSFX", self.ui.ch_jsfx->isChecked());
  408. settings.setValue("PluginDatabase/SearchNative", self.ui.ch_native->isChecked());
  409. settings.setValue("PluginDatabase/SearchPOSIX32", self.ui.ch_posix32->isChecked());
  410. settings.setValue("PluginDatabase/SearchPOSIX64", self.ui.ch_posix64->isChecked());
  411. settings.setValue("PluginDatabase/SearchWin32", self.ui.ch_win32->isChecked());
  412. settings.setValue("PluginDatabase/SearchWin64", self.ui.ch_win64->isChecked());
  413. settings.setValue("PluginDatabase/DoChecks", self.ui.ch_do_checks->isChecked());
  414. }
  415. void PluginListRefreshDialog::slot_start()
  416. {
  417. self.ui.progressBar->setMinimum(0);
  418. self.ui.progressBar->setMaximum(100);
  419. self.ui.progressBar->setValue(0);
  420. self.ui.b_start->setEnabled(false);
  421. self.ui.b_skip->setVisible(true);
  422. self.ui.b_close->setVisible(false);
  423. self.ui.group_types->setEnabled(false);
  424. self.ui.group_options->setEnabled(false);
  425. // if gCarla.utils:
  426. // if self.ui.ch_do_checks.isChecked():
  427. // gCarla.utils.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
  428. // else:
  429. // gCarla.utils.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true")
  430. //
  431. // native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(),
  432. // self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(),
  433. // self.ui.ch_win32.isChecked(), self.ui.ch_win64.isChecked())
  434. //
  435. // ladspa, dssi, lv2, vst, vst3, clap, au, sf2, sfz, jsfx = (self.ui.ch_ladspa.isChecked(), self.ui.ch_dssi.isChecked(),
  436. // self.ui.ch_lv2.isChecked(), self.ui.ch_vst.isChecked(),
  437. // self.ui.ch_vst3.isChecked(), self.ui.ch_clap.isChecked(),
  438. // self.ui.ch_au.isChecked(), self.ui.ch_sf2.isChecked(),
  439. // self.ui.ch_sfz.isChecked(), self.ui.ch_jsfx.isChecked())
  440. //
  441. // self.fThread.setSearchBinaryTypes(native, posix32, posix64, win32, win64)
  442. // self.fThread.setSearchPluginTypes(ladspa, dssi, lv2, vst, vst3, clap, au, sf2, sfz, jsfx)
  443. // self.fThread.start()
  444. }
  445. void PluginListRefreshDialog::slot_skip()
  446. {
  447. // killDiscovery();
  448. }
  449. void PluginListRefreshDialog::slot_checkTools()
  450. {
  451. const bool enabled1 = self.ui.ch_native->isChecked()
  452. || self.ui.ch_posix32->isChecked()
  453. || self.ui.ch_posix64->isChecked()
  454. || self.ui.ch_win32->isChecked()
  455. || self.ui.ch_win64->isChecked();
  456. const bool enabled2 = self.ui.ch_ladspa->isChecked()
  457. || self.ui.ch_dssi->isChecked()
  458. || self.ui.ch_lv2->isChecked()
  459. || self.ui.ch_vst->isChecked()
  460. || self.ui.ch_vst3->isChecked()
  461. || self.ui.ch_clap->isChecked()
  462. || self.ui.ch_au->isChecked()
  463. || self.ui.ch_sf2->isChecked()
  464. || self.ui.ch_sfz->isChecked()
  465. || self.ui.ch_jsfx->isChecked();
  466. self.ui.b_start->setEnabled(enabled1 and enabled2);
  467. }
  468. void PluginListRefreshDialog::slot_handlePluginLook(const int percent, const QString plugin)
  469. {
  470. self.ui.progressBar->setFormat(plugin);
  471. self.ui.progressBar->setValue(percent);
  472. }
  473. void PluginListRefreshDialog::slot_handlePluginThreadFinished()
  474. {
  475. self.ui.progressBar->setMinimum(0);
  476. self.ui.progressBar->setMaximum(1);
  477. self.ui.progressBar->setValue(1);
  478. self.ui.progressBar->setFormat(tr("Done"));
  479. self.ui.b_start->setEnabled(true);
  480. self.ui.b_skip->setVisible(false);
  481. self.ui.b_close->setVisible(true);
  482. self.ui.group_types->setEnabled(true);
  483. self.ui.group_options->setEnabled(true);
  484. }
  485. // --------------------------------------------------------------------------------------------------------------------
  486. const PluginListRefreshDialogResults*
  487. carla_frontend_createAndExecPluginListRefreshDialog(void* const parent, const bool useSystemIcons)
  488. {
  489. PluginListRefreshDialog gui(reinterpret_cast<QWidget*>(parent), useSystemIcons);
  490. if (gui.exec())
  491. {
  492. static PluginListRefreshDialogResults ret = {};
  493. return &ret;
  494. }
  495. return nullptr;
  496. }
  497. // --------------------------------------------------------------------------------------------------------------------