}
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();
}
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%");
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);
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())