Skip to content

Commit

Permalink
Merge pull request #11 from daschuer/bug_1189337
Browse files Browse the repository at this point in the history
Fix default tooltip settings, when mixxx.cfg is empty, fixes Bug #118933...
  • Loading branch information
daschuer committed Jun 17, 2013
2 parents 8a88751 + 3da7b79 commit a574828
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
17 changes: 5 additions & 12 deletions mixxx/src/dlgprefcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,15 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx,
//
// Tooltip configuration
//
// Set default value in config file, if not present
if (m_pConfig->getValueString(ConfigKey("[Controls]","Tooltips")).length() == 0)
m_pConfig->set(ConfigKey("[Controls]","Tooltips"), ConfigValue(1));

ComboBoxTooltips->addItem(tr("On"));
ComboBoxTooltips->addItem(tr("On (only in Library)"));
ComboBoxTooltips->addItem(tr("Off"));
ComboBoxTooltips->addItem(tr("On")); // 1
ComboBoxTooltips->addItem(tr("On (only in Library)")); // 2
ComboBoxTooltips->addItem(tr("Off")); // 0

// Update combo box
int configTooltips = m_pConfig->getValueString(ConfigKey("[Controls]","Tooltips")).toInt();
int configTooltips = m_mixxx->getToolTipsCgf();
// Add two mod-3 makes the on-disk order match up with the combo-box
// order.
ComboBoxTooltips->setCurrentIndex((configTooltips + 2) % 3);

connect(ComboBoxTooltips, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetTooltips(int)));

//
Expand Down Expand Up @@ -432,9 +427,7 @@ void DlgPrefControls::slotSetAutoDjRequeue(int)
void DlgPrefControls::slotSetTooltips(int)
{
int configValue = (ComboBoxTooltips->currentIndex() + 1) % 3;
m_pConfig->set(ConfigKey("[Controls]","Tooltips"),
ConfigValue(configValue));
m_mixxx->setToolTips(configValue);
m_mixxx->setToolTipsCfg(configValue);
}

void DlgPrefControls::notifyRebootNecessary() {
Expand Down
14 changes: 8 additions & 6 deletions mixxx/src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ MixxxApp::MixxxApp(QApplication *pApp, const CmdlineArgs& args)

initializeTranslations(pApp);

// Set the visibility of tooltips
m_tooltips = m_pConfig->getValueString(ConfigKey("[Controls]", "Tooltips")).toInt();
// Set the visibility of tooltips, default "1" = ON
m_toolTipsCfg = m_pConfig->getValueString(ConfigKey("[Controls]", "Tooltips"), "1").toInt();

// Store the path in the config database
m_pConfig->set(ConfigKey("[Config]", "Path"), ConfigValue(resourcePath));
Expand Down Expand Up @@ -1403,8 +1403,10 @@ void MixxxApp::slotHelpManual() {
QDesktopServices::openUrl(qManualUrl);
}

void MixxxApp::setToolTips(int tt) {
m_tooltips = tt;
void MixxxApp::setToolTipsCfg(int tt) {
m_pConfig->set(ConfigKey("[Controls]","Tooltips"),
ConfigValue(tt));
m_toolTipsCfg = tt;
}

void MixxxApp::rebootMixxxView() {
Expand Down Expand Up @@ -1489,14 +1491,14 @@ bool MixxxApp::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::ToolTip) {
// return true for no tool tips
if (m_tooltips == 2) {
if (m_toolTipsCfg == 2) {
// ON (only in Library)
WWidget* pWidget = dynamic_cast<WWidget*>(obj);
WWaveformViewer* pWfViewer = dynamic_cast<WWaveformViewer*>(obj);
WSpinny* pSpinny = dynamic_cast<WSpinny*>(obj);
QLabel* pLabel = dynamic_cast<QLabel*>(obj);
return (pWidget || pWfViewer || pSpinny || pLabel);
} else if (m_tooltips == 1) {
} else if (m_toolTipsCfg == 1) {
// ON
return false;
} else {
Expand Down
5 changes: 3 additions & 2 deletions mixxx/src/mixxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class MixxxApp : public QMainWindow {

void resizeEvent(QResizeEvent *e) { qDebug() << "resize" << e->size();}

void setToolTips(int tt);
void setToolTipsCfg(int tt);
inline int getToolTipsCgf() { return m_toolTipsCfg; };
void rebootMixxxView();

public slots:
Expand Down Expand Up @@ -227,7 +228,7 @@ class MixxxApp : public QMainWindow {
ConfigObject<ConfigValueKbd>* m_pKbdConfig;
ConfigObject<ConfigValueKbd>* m_pKbdConfigEmpty;

int m_tooltips; //0=OFF, 1=ON, 2=ON (only in Library)
int m_toolTipsCfg; //0=OFF, 1=ON, 2=ON (only in Library)
// Timer that tracks how long Mixxx has been running.
Timer m_runtime_timer;

Expand Down

0 comments on commit a574828

Please sign in to comment.