aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--include/qmpcorepublic.hpp3
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp4
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp49
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp5
-rw-r--r--visualization/qmpvisualization.cpp3
6 files changed, 68 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b6b2132..39eb59f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-05-13 0.8.1 alpha
+Added enumerate integer options support.
+Workaroud for different fonts locations in arch linux.
+
2016-05-12 0.8.1 alpha
Now channel labels are displayed correctly.
Add an option to change the tint of the chequer board.
diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp
index 8db9329..88c54a7 100644
--- a/include/qmpcorepublic.hpp
+++ b/include/qmpcorepublic.hpp
@@ -90,6 +90,9 @@ class qmpPluginAPI
virtual void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval);
virtual std::string getOptionString(std::string key);
virtual void setOptionString(std::string key,std::string val);
+ virtual void registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval);
+ virtual int getOptionEnumInt(std::string key);
+ virtual void setOptionEnumInt(std::string key,int val);
};
#ifdef QMP_MAIN
}
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index d67e08a..79ea93c 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -157,3 +157,7 @@ void qmpPluginAPI::registerOptionString(std::string tab,std::string desc,std::st
{qsw->registerOptionString(tab,desc,key,defaultval);}
std::string qmpPluginAPI::getOptionString(std::string key){return qsw->getOptionString(key);}
void qmpPluginAPI::setOptionString(std::string key,std::string val){return qsw->setOptionString(key,val);}
+void qmpPluginAPI::registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval)
+{qsw->registerOptionEnumInt(tab,desc,key,options,defaultval);}
+int qmpPluginAPI::getOptionEnumInt(std::string key){return qsw->getOptionEnumInt(key);}
+void qmpPluginAPI::setOptionEnumInt(std::string key,int val){return qsw->setOptionEnumInt(key,val);}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index 2d6912c..b47c2ba 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -357,6 +357,13 @@ void qmpSettingsWindow::updateCustomOptions()
{
QLineEdit* te=(QLineEdit*)i->second.widget;if(!i->second.widget)break;
settings->setValue(QString(i->first.c_str()),te->text());
+ break;
+ }
+ case 5:
+ {
+ QComboBox* cb=(QComboBox*)i->second.widget;if(!i->second.widget)break;
+ settings->setValue(QString(i->first.c_str()),cb->currentIndex());
+ break;
}
}
}
@@ -568,3 +575,45 @@ void qmpSettingsWindow::setOptionString(std::string key,std::string val)
if(customOptions[key].widget)
((QLineEdit*)customOptions[key].widget)->setText(val.c_str());
}
+
+void qmpSettingsWindow::registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval)
+{
+ customOptions[key].widget=NULL;
+ customOptions[key].desc=desc;
+ customOptions[key].defaultval=defaultval;
+ customOptions[key].type=5;
+ if(desc.length())
+ {
+ QGridLayout* page=NULL;
+ if(customOptPages[tab])page=customOptPages[tab];
+ else
+ {
+ QWidget* w=new QWidget;
+ page=new QGridLayout(w);
+ w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ ui->tabWidget->addTab(w,QString(tab.c_str()));
+ customOptPages[tab]=page;
+ }
+ QComboBox* sb=new QComboBox(page->parentWidget());
+ QLabel* lb=new QLabel(desc.c_str(),page->parentWidget());
+ customOptions[key].widget=sb;
+ for(unsigned i=0;i<options.size();++i)sb->addItem(options[i].c_str());
+ sb->setCurrentIndex(settings->value(QString(key.c_str()),defaultval).toInt());
+ sb->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ int row=page->rowCount();
+ page->addWidget(lb,row,0);
+ page->addWidget(sb,row,1);
+
+ }
+}
+int qmpSettingsWindow::getOptionEnumInt(std::string key)
+{
+ return settings->value(QString(key.c_str()),customOptions[key].defaultval).toInt();
+}
+void qmpSettingsWindow::setOptionEnumInt(std::string key,int val)
+{
+ settings->setValue(QString(key.c_str()),val);
+ if(customOptions[key].widget)
+ ((QComboBox*)customOptions[key].widget)->setCurrentIndex(val);
+}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp
index 3820279..9f5e6cf 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.hpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.hpp
@@ -1,7 +1,9 @@
#ifndef QMPSETTINGSWINDOW_H
#define QMPSETTINGSWINDOW_H
+#include <string>
#include <map>
+#include <vector>
#include <QDialog>
#include <QCloseEvent>
#include <QSettings>
@@ -83,6 +85,9 @@ class qmpSettingsWindow:public QDialog
void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval);
std::string getOptionString(std::string key);
void setOptionString(std::string key,std::string val);
+ void registerOptionEnumInt(std::string tab,std::string desc,std::string key,std::vector<std::string> options,int defaultval);
+ int getOptionEnumInt(std::string key);
+ void setOptionEnumInt(std::string key,int val);
signals:
void dialogClosing();
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index f2c663e..607b2ea 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -79,10 +79,13 @@ void qmpVisualization::showThread()
if(noteappearance==1)nebuf=new smEntity3DBuffer();else nebuf=NULL;
tdscn=sm->smTargetCreate(wwidth*wsupersample,wheight*wsupersample,wmultisample);
if(!font.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",16))
+ if(!font.loadTTF("/usr/share/fonts/gnu-free-fonts/FreeMono.otf",16))
printf("W: Font load failed.\n");
if(!fonthdpi.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",180))
+ if(!fonthdpi.loadTTF("/usr/share/fonts/gnu-free-fonts/FreeMono.otf",180))
printf("W: Font load failed.\n");
if(!font2.loadTTF("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",16))
+ if(!font2.loadTTF("/usr/share/fonts/wenquanyi/wqy-microhei/wqy-microhei.ttc",16))
printf("W: Font load failed.\n");
pos[0]=0;pos[1]=120;pos[2]=70;
rot[0]=0;rot[1]=75;rot[2]=90;ctk=0;