diff options
author | Chris Xiong <chirs241097@gmail.com> | 2015-12-31 23:49:04 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2015-12-31 23:49:04 +0800 |
commit | 3db127ce64eadb54568e218124744a1de713667e (patch) | |
tree | e360f2cba2afb1c369e28907aa19934cf3c45ca5 /qmpinfowindow.cpp | |
parent | b1be9e45b5abdf0a03181b9cee8dc208a762fe57 (diff) | |
download | QMidiPlayer-3db127ce64eadb54568e218124744a1de713667e.tar.xz |
Inanimate Dream. (WTF)
Diffstat (limited to 'qmpinfowindow.cpp')
-rw-r--r-- | qmpinfowindow.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/qmpinfowindow.cpp b/qmpinfowindow.cpp new file mode 100644 index 0000000..93cbb81 --- /dev/null +++ b/qmpinfowindow.cpp @@ -0,0 +1,33 @@ +#include "qmpinfowindow.hpp" +#include "ui_qmpinfowindow.h" +#include "qmpmainwindow.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#"; + +qmpInfoWindow::qmpInfoWindow(QWidget *parent) : + QDialog(parent), + ui(new Ui::qmpInfoWindow) +{ + ui->setupUi(this); +} + +qmpInfoWindow::~qmpInfoWindow() +{ + delete ui; +} + +void qmpInfoWindow::updateInfo() +{ + char str[256]; + CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer(); + ui->lbFileName->setText(QString("File name: ")+qmpMainWindow::getInstance()->getFileName()); + if(player->getTitle())ui->lbTitle->setText(QString("Title: ")+player->getTitle()); + if(player->getCopyright())ui->lbCopyright->setText(QString("Copyright: ")+player->getCopyright()); + ui->lbTempo->setText(QString("Tempo: ")+QString::number(player->getTempo(),'g',5)); + int t,r;player->getCurrentKeySignature(&t);r=(int8_t)((t>>8)&0xFF)+7; + strncpy(str,t&0xFF?minors+2*r:majors+2*r,2);str[2]='\0'; + ui->lbKeySig->setText(QString("Key Sig.: ")+str); + player->getCurrentTimeSignature(&t,&r);sprintf(str,"Time Sig.: %d/%d",t,r); + ui->lbTimeSig->setText(str); +} |