Commit 612f6497 authored by Scott Wheeler's avatar Scott Wheeler

Store the volume using kconfig on exit and read it on startup.

svn path=/trunk/kdemultimedia/juk/; revision=143218
parent 5fd9d353
......@@ -31,10 +31,12 @@ JuK::JuK(QWidget *parent, const char *name) : KMainWindow(parent, name)
setupActions();
setupLayout();
setupPlayer();
readConfig();
}
JuK::~JuK()
{
saveConfig();
}
////////////////////////////////////////////////////////////////////////////////
......@@ -105,10 +107,31 @@ void JuK::setupPlayer()
sliderAction->getTrackPositionSlider()->setEnabled(false);
connect(sliderAction->getVolumeSlider(), SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
sliderAction->getVolumeSlider()->setValue(sliderAction->getVolumeSlider()->maxValue());
}
}
void JuK::readConfig()
{
KConfig *config = KGlobal::config();
{ // player settings
KConfigGroupSaver saver(config, "Player");
if(sliderAction && sliderAction->getVolumeSlider()) {
int volume = config->readNumEntry("Volume", sliderAction->getVolumeSlider()->maxValue());
sliderAction->getVolumeSlider()->setValue(volume);
}
}
}
void JuK::saveConfig()
{
KConfig *config = KGlobal::config();
{ // player settings
KConfigGroupSaver saver(config, "Player");
if(sliderAction && sliderAction->getVolumeSlider())
config->writeEntry("Volume", sliderAction->getVolumeSlider()->value());
}
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// private slot definitions
......@@ -138,7 +161,7 @@ void JuK::saveFile()
void JuK::quit()
{
kapp->quit();
delete(this);
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -46,6 +46,8 @@ private:
void setupActions();
void setupLayout();
void setupPlayer();
void readConfig();
void saveConfig();
// layout objects
TaggerWidget *tagger;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment