aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-01 17:48:03 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-01 17:48:03 +0800
commiteddc629bd637ec5d9260849d095b6951a437360d (patch)
tree98fd45c4b4e2ed3bdcc213722de76df0decd3b18
parent8a0d671e1a77c58142d0cbe82f40ee64bcae2be5 (diff)
downloadQMidiPlayer-eddc629bd637ec5d9260849d095b6951a437360d.tar.xz
Make packaging qmidiplayer less painful.
Add mime info. Do not throw integers. Fix incorrect font paths in Arch Linux.
-rw-r--r--ChangeLog6
-rw-r--r--core/qmpmidiread.cpp8
-rw-r--r--doc/qmidiplayer15
-rw-r--r--qmidiplayer-desktop/qmidiplayer-desktop.pro4
-rw-r--r--qmidiplayer-desktop/qmidiplayer.mime11
-rw-r--r--visualization/qmpvisualization.cpp4
-rw-r--r--visualization/visualization.pro18
7 files changed, 54 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 445cdff..0208bb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-01 0.8.3 alpha
+Make packaging qmidiplayer less painful.
+Add mime info.
+Do not throw integers.
+Fix incorrect font paths in Arch Linux.
+
2017-01-15 0.8.3 alpha
A little code refactoring.
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp
index a8bdabb..dc58ecc 100644
--- a/core/qmpmidiread.cpp
+++ b/core/qmpmidiread.cpp
@@ -18,7 +18,7 @@ void CMidiFile::error(int fatal,const char* format,...)
va_list ap;
va_start(ap,format);vfprintf(stderr,format,ap);va_end(ap);
fprintf(stderr," at %#lx\n",ftell(f));
- if(fatal)throw 2;
+ if(fatal)throw std::runtime_error("fatal error");
}
uint32_t CMidiFile::readSW()
{
@@ -209,7 +209,7 @@ int CMidiFile::chunkReader(int hdrXp)
char hdr[6];
if(!fgets(hdr,5,f))error(1,"E: Unexpected EOF.");
if(hdrXp)
- if(strncmp(hdr,"MThd",4)){error(1,"E: Wrong MIDI header.");throw 1;}
+ if(strncmp(hdr,"MThd",4)){error(1,"E: Wrong MIDI header.");throw std::runtime_error("Wrong MIDI header");}
else return headerChunkReader(),0;
else
if(strncmp(hdr,"MTrk",4))
@@ -236,14 +236,14 @@ CMidiFile::CMidiFile(const char* fn,CMidiPlayer* par)
memcpy(eventReaderCBuserdata,par->eventReaderCBuserdata,sizeof(eventReaderCBuserdata));
try
{
- if(!(f=fopen(fn,"rb")))throw (fprintf(stderr,"E: file %s doesn't exist!\n",fn),2);
+ if(!(f=fopen(fn,"rb")))throw (fprintf(stderr,"E: file %s doesn't exist!\n",fn),std::runtime_error("File doesn't exist"));
chunkReader(1);
for(uint32_t i=0;i<trk;i+=chunkReader(0));
fclose(f);
std::sort(eventList.begin(),eventList.end(),cmp);
par->maxtk=eventList[eventList.size()-1]->time;
}
- catch(int&){fprintf(stderr,"E: %s is not a supported file.\n",fn);valid=0;}
+ catch(std::runtime_error&){fprintf(stderr,"E: %s is not a supported file.\n",fn);valid=0;}
}
CMidiFile::~CMidiFile()
{
diff --git a/doc/qmidiplayer b/doc/qmidiplayer
new file mode 100644
index 0000000..8dacdb1
--- /dev/null
+++ b/doc/qmidiplayer
@@ -0,0 +1,15 @@
+.\" Manpage for qmidiplayer.
+.TH man 1 "29 Dec 2016" "0.8.3" "qmidiplayer man page"
+.SH NAME
+qmidiplayer \- Plays midi file
+.SH SYNOPSIS
+qmidiplayer [Options] [Midi Files]
+.SH DESCRIPTION
+QMidiPlayer is a cross-platform midi file player based on libfluidsynth and Qt.
+.SH OPTIONS
+Possible options are:
+ -l, --load-all-files Load all files from the same folder.
+ --help Show this help and exit.
+ --version Show this version information and exit.
+.SH AUTHOR
+Chris Xiong (chirs241097@gmail.com)
diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro
index 5572479..4a04d6b 100644
--- a/qmidiplayer-desktop/qmidiplayer-desktop.pro
+++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro
@@ -82,7 +82,7 @@ unix{
BINDIR = $$PREFIX/bin
target.path = $$BINDIR
DATADIR = $$PREFIX/share
- INSTALLS += target desktop iconbmp iconsvg iconxpm doc docimg appdata menu
+ INSTALLS += target desktop iconbmp iconsvg iconxpm doc docimg appdata menu mimetype
desktop.path = $$DATADIR/applications
desktop.files += $${TARGET}.desktop
iconbmp.path = $$DATADIR/icons/hicolor/64x64/apps
@@ -99,6 +99,8 @@ unix{
appdata.files += $${TARGET}.appdata.xml
menu.path = $${DATADIR}/menu
menu.files += ./menu/$${TARGET}
+ mimetype.path = $$DATADIR/mime/packages
+ mimetype.files += $${TARGET}.mime
QMAKE_CXXFLAGS += -Wall
LIBS += -lfluidsynth -lrtmidi -ldl
}
diff --git a/qmidiplayer-desktop/qmidiplayer.mime b/qmidiplayer-desktop/qmidiplayer.mime
new file mode 100644
index 0000000..becf239
--- /dev/null
+++ b/qmidiplayer-desktop/qmidiplayer.mime
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+ <mime-type type="audio/midi">
+ <comment>MIDI audio</comment>
+ <magic priority="50">
+ <match type="string" offset="0" value="MThd"/>
+ </magic>
+ <glob pattern="*.mid"/>
+ <glob pattern="*.midi"/>
+ </mime-type>
+</mime-info>
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index ca7e8d6..193cde4 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -155,12 +155,12 @@ void qmpVisualization::showThread()
tdparticles=sm->smTargetCreate(wwidth*wsupersample,wheight*wsupersample,wmultisample);
if(!api->getOptionString("Visualization/font2").length()||!font.loadTTF(api->getOptionString("Visualization/font2").c_str(),fontsize))
if(!font.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",fontsize))
- if(!font.loadTTF("/usr/share/fonts/gnu-free-fonts/FreeMono.otf",fontsize))
+ if(!font.loadTTF("/usr/share/fonts/gnu-free/FreeMono.otf",fontsize))
if(!font.loadTTF("C:/Windows/Fonts/cour.ttf",fontsize))
printf("W: Font load failed.\n");
if(!api->getOptionString("Visualization/font2").length()||!font.loadTTF(api->getOptionString("Visualization/font2").c_str(),180))
if(!fonthdpi.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",180))
- if(!fonthdpi.loadTTF("/usr/share/fonts/gnu-free-fonts/FreeMono.otf",180))
+ if(!fonthdpi.loadTTF("/usr/share/fonts/gnu-free/FreeMono.otf",180))
if(!fonthdpi.loadTTF("C:/Windows/Fonts/cour.ttf",180))
printf("W: Font load failed.\n");
if(!api->getOptionString("Visualization/font1").length()||!font.loadTTF(api->getOptionString("Visualization/font1").c_str(),fontsize))
diff --git a/visualization/visualization.pro b/visualization/visualization.pro
index fedd636..5bf08ea 100644
--- a/visualization/visualization.pro
+++ b/visualization/visualization.pro
@@ -22,7 +22,7 @@ HEADERS += qmpvisualization.hpp \
qmpvirtualpiano3d.hpp
unix {
- target.path = /usr/lib/qmidiplayer
+ target.path = $$PREFIX/lib/qmidiplayer
DATADIR = $$PREFIX/share
INSTALLS += target res
QMAKE_CXXFLAGS += -pthread -fPIC
@@ -33,10 +33,18 @@ unix {
res.path = $$DATADIR/qmidiplayer/img
res.files += ../img/chequerboard.png ../img/particle.png ../img/kb_128.png
#well...
- INCLUDEPATH += /home/chrisoft/devel/SMELT/include/ /usr/include/freetype2
- LIBS += -L/home/chrisoft/devel/SMELT/smelt/glfw/
- LIBS += -L/home/chrisoft/devel/SMELT/extensions/
- LIBS += -lstdc++ -lfreetype -lz -lsmeltext -lsmelt-dumb -lCxImage -ljpeg -lpng -lglfw -lGLEW -lGL
+ SMELTDIR = $$(SMELT_DIR)
+ isEmpty(SMELTDIR){
+ INCLUDEPATH += /home/chrisoft/devel/SMELT/include/ /usr/include/freetype2
+ LIBS += -L/home/chrisoft/devel/SMELT/smelt/glfw/
+ LIBS += -L/home/chrisoft/devel/SMELT/extensions/
+ LIBS += -lstdc++ -lfreetype -lz -lsmeltext -lsmelt-dumb -lCxImage -ljpeg -lpng -lglfw -lGLEW -lGL
+ }else{
+ INCLUDEPATH += $$SMELTDIR/include/ /usr/include/freetype2
+ LIBS += -L$$SMELTDIR/smelt/glfw/
+ LIBS += -L$$SMELTDIR/extensions/
+ LIBS += -lstdc++ -lfreetype -lz -lsmeltext -lsmelt-dumb -lCxImage -ljpeg -lpng -lglfw -lGLEW -lGL
+ }
}
win32 {
#Change these before producing your own build!