X-Git-Url: http://git.johnwright.org/?p=fmit.git;a=blobdiff_plain;f=src%2Fmodules%2FGLVolumeHistory.cpp;fp=src%2Fmodules%2FGLVolumeHistory.cpp;h=92f0994adbe00789b389a2d82575ac2ef6c0f51e;hp=57c5f81b6a993b5cedcfcdf9932bffb7ff6557fe;hb=a8fb82288feb6b258f2c04312f0c36ba8d79b494;hpb=adfba0402927438a1869f1e716bcf0e25574ce1e diff --git a/src/modules/GLVolumeHistory.cpp b/src/modules/GLVolumeHistory.cpp index 57c5f81..92f0994 100644 --- a/src/modules/GLVolumeHistory.cpp +++ b/src/modules/GLVolumeHistory.cpp @@ -188,48 +188,47 @@ GLVolumeHistory::Note::Note(int h, float cents) } QString GLVolumeHistory::Note::getName() const { - return Music::h2n(ht)+factor; + return QString::fromStdString(Music::h2n(ht))+factor; } GLVolumeHistory::GLVolumeHistory(QWidget* parent) -: QGLWidget(parent, "GLVolumeHistory") -, View("Volume history", this) +: QGLWidget(parent) +, View(tr("Volume history"), this) { - QImage img; - setting_show->setToggleAction(true); + QPixmap img; + setting_show->setCheckable(true); img.loadFromData(g_icon_volume_graph, sizeof(g_icon_volume_graph), "PNG"); - setting_show->setIconSet(QIconSet(QImage(img))); - setting_show->setOn(false); + setting_show->setIcon(QIcon(img)); + setting_show->setChecked(false); hide(); m_volume_treshold = -100; - setting_keep = new QAction(this); - setting_keep->setMenuText(tr("Keep previous notes")); - setting_keep->setToggleAction(true); - setting_keep->setOn(false); + setting_keep = new QAction(tr("Keep previous notes"), this); + setting_keep->setCheckable(true); + setting_keep->setChecked(false); connect(setting_keep, SIGNAL(toggled(bool)), this, SLOT(keepPreviousNotes(bool))); -// setting_keep->addTo(&m_popup_menu); + m_popup_menu.addAction(setting_keep); } void GLVolumeHistory::save() { - s_settings->writeEntry("keep", setting_keep->isOn()); + s_settings->setValue("keep", setting_keep->isChecked()); } void GLVolumeHistory::load() { - setting_keep->setOn(s_settings->readBoolEntry("keep", setting_keep->isOn())); + setting_keep->setChecked(s_settings->value("keep", setting_keep->isChecked()).toBool()); } void GLVolumeHistory::clearSettings() { - s_settings->removeEntry("keep"); + s_settings->remove("keep"); } void GLVolumeHistory::addNote(GLVolumeHistory::Note note) { m_notes.push_back(note); - if(!setting_keep->isOn()) + if(!setting_keep->isChecked()) while(m_notes.size()>1) m_notes.pop_front(); } @@ -270,11 +269,11 @@ void GLVolumeHistory::paintGL() glLineWidth(1.0f); // name - QString str = tr("Volume"); + string str = tr("Volume").toStdString(); glColor3f(0.75,0.75,0.75); glRasterPos2i(2, height()-20); for(size_t i = 0; i < str.length(); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str.latin1()[i]); + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, (unsigned char)str[i]); int s = 2+fontMetrics().width("50%"); @@ -309,19 +308,19 @@ void GLVolumeHistory::paintGL() string sfraq = "-10"; glRasterPos2i(2, height()-10*height()/50-dy); for(size_t i = 0; i < sfraq.size(); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]); + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, (unsigned char)sfraq[i]); sfraq = "-20"; glRasterPos2i(2, height()-20*height()/50-dy); for(size_t i = 0; i < sfraq.size(); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]); + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, (unsigned char)sfraq[i]); sfraq = "-30"; glRasterPos2i(2, height()-30*height()/50-dy); for(size_t i = 0; i < sfraq.size(); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]); + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, (unsigned char)sfraq[i]); sfraq = "-40"; glRasterPos2i(2, height()-40*height()/50-dy); for(size_t i = 0; i < sfraq.size(); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]); + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, (unsigned char)sfraq[i]); glColor3f(1.0,0.5,0.5); glLineWidth(2.0f); @@ -361,7 +360,7 @@ void GLVolumeHistory::paintGL() glColor3f(0.0,0.0,1.0); glRasterPos2f(x+2, 2); for(size_t c=0; c