aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-06 23:43:01 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-06 23:43:01 +0800
commit909cfe195ae2f6058a03875123f1e80f2a3fa0fa (patch)
tree9a6fcc0fa6390b8f503881999e4f08a8cd650c49 /qmidiplayer-desktop
parent8da0f5c82fb91c2731cd2e90a875fe92c6557407 (diff)
downloadQMidiPlayer-909cfe195ae2f6058a03875123f1e80f2a3fa0fa.tar.xz
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.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmidiplayer-desktop.pro4
-rw-r--r--qmidiplayer-desktop/qmphelpwindow.hpp2
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp5
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp15
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp12
5 files changed, 24 insertions, 14 deletions
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 <QDialog>
-#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;i<plugins.size();++i)delete plugins[i].interface;
- qmw=NULL;qsw=NULL;
+ for(unsigned i=0;i<plugins.size();++i)
+ {
+ if(plugins[i].enabled)plugins[i].interface->deinit();
+ delete plugins[i].interface;
+ }
+ qmw=NULL;qsw=NULL;delete pluginAPI;
}
std::vector<qmpPlugin> *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 <QPlainTextEdit>
+#include <QLineEdit>
#include <QFileDialog>
#include <QDir>
#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());
}