Further work in themes for the ui and some further bug fix.
This commit is contained in:
@@ -36,7 +36,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
}
|
||||
}
|
||||
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QSettings settings("companion", "companion");
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
path.append("/SOUNDS/");
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
@@ -123,9 +123,22 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));
|
||||
|
||||
#ifdef PHONON
|
||||
QSettings settings("companion", "companion");
|
||||
int theme_set=settings.value("theme", 1).toInt();
|
||||
QString Theme;
|
||||
switch(theme_set) {
|
||||
case 0:
|
||||
Theme="classic";
|
||||
break;
|
||||
default:
|
||||
Theme="monochrome";
|
||||
break;
|
||||
}
|
||||
QIcon PlayIcon;
|
||||
populate_icon(&PlayIcon,Theme,"play.png");
|
||||
playBT[i] = new QPushButton(this);
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[i]->setIcon(PlayIcon);
|
||||
paramLayout->addWidget(playBT[i]);
|
||||
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
|
||||
#endif
|
||||
@@ -160,6 +173,20 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
{
|
||||
if (phononLock)
|
||||
return;
|
||||
QSettings settings("companion", "companion");
|
||||
int theme_set=settings.value("theme", 1).toInt();
|
||||
QString Theme;
|
||||
switch(theme_set) {
|
||||
case 0:
|
||||
Theme="classic";
|
||||
break;
|
||||
default:
|
||||
Theme="monochrome";
|
||||
break;
|
||||
}
|
||||
QIcon PlayIcon;
|
||||
populate_icon(&PlayIcon,Theme,"play.png");
|
||||
|
||||
phononLock=true;
|
||||
if ((newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
|
||||
clickObject->stop();
|
||||
@@ -167,7 +194,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
clickObject->clear();
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[i]->setIcon(PlayIcon);
|
||||
}
|
||||
}
|
||||
if (newState==Phonon::ErrorState) {
|
||||
@@ -176,7 +203,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
clickObject->clear();
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[i]->setIcon(PlayIcon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +216,22 @@ void CustomFunctionsPanel::playMusic()
|
||||
QPushButton *playButton = qobject_cast<QPushButton*>(sender());
|
||||
int index=playButton->objectName().mid(5,2).toInt();
|
||||
QString function=playButton->objectName().left(4);
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QSettings settings("companion", "companion");
|
||||
int theme_set=settings.value("theme", 1).toInt();
|
||||
QString Theme;
|
||||
switch(theme_set) {
|
||||
case 0:
|
||||
Theme="classic";
|
||||
break;
|
||||
default:
|
||||
Theme="monochrome";
|
||||
break;
|
||||
}
|
||||
QIcon PlayIcon;
|
||||
populate_icon(&PlayIcon,Theme,"play.png");
|
||||
QIcon StopIcon;
|
||||
populate_icon(&StopIcon,Theme,"stop.png");
|
||||
|
||||
QString path=settings.value("sdPath", ".").toString();
|
||||
QDir qd(path);
|
||||
QString track;
|
||||
@@ -217,12 +259,12 @@ void CustomFunctionsPanel::playMusic()
|
||||
clickObject->setCurrentSource(Phonon::MediaSource(track));
|
||||
clickObject->play();
|
||||
playBT[index]->setObjectName(QString("stop_%1").arg(index));
|
||||
playBT[index]->setIcon(QIcon(":/images/stop.png"));
|
||||
playBT[index]->setIcon(StopIcon);
|
||||
} else {
|
||||
clickObject->stop();
|
||||
clickObject->clear();
|
||||
playBT[index]->setObjectName(QString("play_%1").arg(index));
|
||||
playBT[index]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[index]->setIcon(PlayIcon);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -457,6 +499,25 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
selectedFunction = label->property("index").toInt();
|
||||
QSettings settings("companion", "companion");
|
||||
int theme_set=settings.value("theme", 1).toInt();
|
||||
QString Theme;
|
||||
switch(theme_set) {
|
||||
case 0:
|
||||
Theme="classic";
|
||||
break;
|
||||
default:
|
||||
Theme="monochrome";
|
||||
break;
|
||||
}
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,Theme,"clear.png");
|
||||
QIcon CopyIcon;
|
||||
populate_icon(&CopyIcon,Theme,"copy.png");
|
||||
QIcon CutIcon;
|
||||
populate_icon(&CutIcon,Theme,"cut.png");
|
||||
QIcon PasteIcon;
|
||||
populate_icon(&PasteIcon,Theme,"paste.png");
|
||||
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
|
||||
@@ -465,10 +526,10 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
||||
bool hasData = mimeData->hasFormat("application/x-companion9x-fsw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user