Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default tooltip settings, when mixxx.cfg is empty, fixes Bug #118933... #11

Merged
merged 2 commits into from
Jun 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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