diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-01-02 23:57:36 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-01-02 23:57:36 +0800 |
commit | b886aa1fcafc16fe93bfe19e2f63b4089234f9f6 (patch) | |
tree | 929ed0c3fc60b4e9fce421718c21062059c2cbd9 /qmpinfowindow.cpp | |
parent | d418712c981d9854fa6429d65773368ca63b8dac (diff) | |
download | QMidiPlayer-b886aa1fcafc16fe93bfe19e2f63b4089234f9f6.tar.xz |
Mystic Flier. (WTF)
Diffstat (limited to 'qmpinfowindow.cpp')
-rw-r--r-- | qmpinfowindow.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/qmpinfowindow.cpp b/qmpinfowindow.cpp index 4e214b4..aecd58f 100644 --- a/qmpinfowindow.cpp +++ b/qmpinfowindow.cpp @@ -1,9 +1,12 @@ +#include <QTextCodec> #include "qmpinfowindow.hpp" #include "ui_qmpinfowindow.h" #include "qmpmainwindow.hpp" +#include "qmpsettingswindow.hpp" const char* minors="abebbbf c g d a e b f#c#g#d#a#"; const char* majors="CbGbDbAbEbBbF C G D A E B F#C#"; +const char* standards="? GM GM2GS XG "; qmpInfoWindow::qmpInfoWindow(QWidget *parent) : QDialog(parent), @@ -21,10 +24,25 @@ void qmpInfoWindow::updateInfo() { char str[256]; CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer(); + const QSettings* settings=qmpSettingsWindow::getSettingsIntf(); ui->lbFileName->setText(QString("File name: ")+qmpMainWindow::getInstance()->getFileName()); - if(player->getTitle())ui->lbTitle->setText(QString("Title: ")+player->getTitle()); + if(player->getTitle()) + { + if(settings->value("Midi/TextEncoding","").toString()!="Unicode") + ui->lbTitle->setText(QString("Title: ")+ + QTextCodec::codecForName(settings->value("Midi/TextEncoding","").toString().toStdString().c_str())->toUnicode(player->getTitle())); + else + ui->lbTitle->setText(QString("Title: ")+player->getTitle()); + } else ui->lbTitle->setText(QString("Title: ")); - if(player->getCopyright())ui->lbCopyright->setText(QString("Copyright: ")+player->getCopyright()); + if(player->getCopyright()) + { + if(settings->value("Midi/TextEncoding","").toString()!="Unicode") + ui->lbCopyright->setText(QString("Copyright: ")+ + QTextCodec::codecForName(settings->value("Midi/TextEncoding","").toString().toStdString().c_str())->toUnicode(player->getCopyright())); + else + ui->lbCopyright->setText(QString("Copyright: ")+player->getCopyright()); + } else ui->lbCopyright->setText(QString("Copyright: ")); ui->lbTempo->setText(QString("Tempo: ")+QString::number(player->getTempo(),'g',5)); int t,r;player->getCurrentKeySignature(&t);r=(int8_t)((t>>8)&0xFF)+7; @@ -34,4 +52,6 @@ void qmpInfoWindow::updateInfo() ui->lbTimeSig->setText(str); sprintf(str,"Note count: %u",player->getFileNoteCount()); ui->lbNoteCount->setText(str); + strncpy(str,standards+player->getFileStandard()*3,3);str[3]='\0'; + ui->lbFileStandard->setText(QString("File standard: ")+str); } |