Import upstream version 0.99.2
[fmit.git] / src / modules / GLVolumeHistory.cpp
index 57c5f81..92f0994 100644 (file)
@@ -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<str.length(); c++)
-                               glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[c]);
+                               glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, (unsigned char)str[c]);
 
                        // draw the volume graph
                        if(!m_notes[i].volumes.empty())