From 909cfe195ae2f6058a03875123f1e80f2a3fa0fa Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 6 May 2016 23:43:01 +0800 Subject: Use new SMELT rendering API for notes drawing. Deinitialize classes in a correct order to avoid crashes. Add background image option. Add FPS-related options. Use QLineEdit instead of QPlainTextEdit for strings. --- qmidiplayer-desktop/qmidiplayer-desktop.pro | 4 ++++ qmidiplayer-desktop/qmphelpwindow.hpp | 2 +- qmidiplayer-desktop/qmpmainwindow.cpp | 5 ++--- qmidiplayer-desktop/qmpplugin.cpp | 15 +++++++++++---- qmidiplayer-desktop/qmpsettingswindow.cpp | 12 ++++++------ 5 files changed, 24 insertions(+), 14 deletions(-) (limited to 'qmidiplayer-desktop') diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro index e3d6492..01ad0cc 100644 --- a/qmidiplayer-desktop/qmidiplayer-desktop.pro +++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro @@ -68,6 +68,10 @@ unix{ message(Building in packaging mode...) DEFINES += QMP_BUILD_UNIX_PACKAGE } + QMAKE_CXXFLAGS_RELEASE -= -O2 + QMAKE_CXXFLAGS_RELEASE += -O3 + QMAKE_LFLAGS_RELEASE -= -O1 + QMAKE_LFLAGS_RELEASE += -O3 BINDIR = $$PREFIX/bin target.path = $$BINDIR DATADIR = $$PREFIX/share diff --git a/qmidiplayer-desktop/qmphelpwindow.hpp b/qmidiplayer-desktop/qmphelpwindow.hpp index 053a738..6b1d719 100644 --- a/qmidiplayer-desktop/qmphelpwindow.hpp +++ b/qmidiplayer-desktop/qmphelpwindow.hpp @@ -2,7 +2,7 @@ #define QMPHELPWINDOW_H #include -#define APP_VERSION "0.8.0" +#define APP_VERSION "0.8.1" namespace Ui { class qmpHelpWindow; diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index d25cadd..3842757 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -61,9 +61,8 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : qmpMainWindow::~qmpMainWindow() { - if(player)delete player; - if(timer)delete timer; - delete pmgr;delete ui; + delete pmgr;if(player)delete player; + if(timer)delete timer;delete ui; } void qmpMainWindow::init() diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index f014902..b05ca0c 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -9,7 +9,7 @@ #include "qmpplugin.hpp" #include "qmpmainwindow.hpp" #include "qmpsettingswindow.hpp" -qmpPluginAPI pluginAPI; +qmpPluginAPI* pluginAPI; qmpMainWindow* qmw; qmpSettingsWindow* qsw; #ifdef _WIN32 @@ -48,7 +48,7 @@ void qmpPluginManager::scanPlugins() void* hndi=dlsym(hso,"qmpPluginGetInterface"); if(!hndi)continue; qmpPluginEntry e=(qmpPluginEntry)hndi; - qmpPluginIntf* intf=e(&pluginAPI); + qmpPluginIntf* intf=e(pluginAPI); plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); } } @@ -57,11 +57,16 @@ qmpPluginManager::qmpPluginManager() { qmw=qmpMainWindow::getInstance(); qsw=qmw->getSettingsWindow(); + pluginAPI=new qmpPluginAPI(); } qmpPluginManager::~qmpPluginManager() { - for(unsigned i=0;ideinit(); + delete plugins[i].interface; + } + qmw=NULL;qsw=NULL;delete pluginAPI; } std::vector *qmpPluginManager::getPlugins() { @@ -82,6 +87,8 @@ void qmpPluginManager::deinitPlugins() plugins[i].interface->deinit(); } +qmpPluginAPI::~qmpPluginAPI(){} + uint32_t qmpPluginAPI::getDivision() {return qmw&&qmw->getPlayer()?qmw->getPlayer()->getDivision():0;} uint32_t qmpPluginAPI::getRawTempo() diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index ad9ac14..45f84c3 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "qmpsettingswindow.hpp" @@ -347,8 +347,8 @@ void qmpSettingsWindow::updateCustomOptions() } case 4: { - QPlainTextEdit* te=(QPlainTextEdit*)i->second.widget; - settings->setValue(QString(i->first.c_str()),te->toPlainText()); + QLineEdit* te=(QLineEdit*)i->second.widget; + settings->setValue(QString(i->first.c_str()),te->text()); } } } @@ -536,7 +536,7 @@ void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,st ui->tabWidget->addTab(w,QString(tab.c_str())); customOptPages[tab]=page; } - QPlainTextEdit* te=new QPlainTextEdit(page->parentWidget()); + QLineEdit* te=new QLineEdit(page->parentWidget()); QLabel* lb=new QLabel(desc.c_str(),page->parentWidget()); customOptions[key].widget=te; te->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); @@ -544,7 +544,7 @@ void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,st int row=page->rowCount(); page->addWidget(lb,row,0); page->addWidget(te,row,1); - te->setPlainText(defaultval.c_str()); + te->setText(settings->value(QString(key.c_str()),defaultval.c_str()).toString()); } } std::string qmpSettingsWindow::getOptionString(std::string key) @@ -554,5 +554,5 @@ std::string qmpSettingsWindow::getOptionString(std::string key) void qmpSettingsWindow::setOptionString(std::string key,std::string val) { settings->setValue(QString(key.c_str()),QString(val.c_str())); - ((QPlainTextEdit*)customOptions[key].widget)->setPlainText(val.c_str()); + ((QLineEdit*)customOptions[key].widget)->setText(val.c_str()); } -- cgit v1.2.3