00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include <qlayout.h>
00013
#include <qlabel.h>
00014
#include <qfont.h>
00015
#include <qcheckbox.h>
00016
#include <qframe.h>
00017
#include <qvgroupbox.h>
00018
#include <qapplication.h>
00019
00020
00021
#include "alertsWidget.h"
00022
#include "configuration.h"
00023
#include "../config.h"
00024
#include "../gui/window.h"
00025
#include "../gui/statusWidget.h"
00026
00027
00028 AlertsWidget::AlertsWidget(
Configuration* config,
QWidget* parent,
00029
const char* name ) :
QWidget( parent, name)
00030 {
00031 this->config = config;
00032
00033
categoryLabel =
new QLabel( tr(
"Alerts:"),
this);
00034 QFont labelFont =
categoryLabel->font();
00035 labelFont.setWeight(QFont::Bold);
00036
categoryLabel->setFont( labelFont );
00037
00038
horizontalLine =
new QFrame(
this);
00039
horizontalLine->setLineWidth(2);
00040
horizontalLine->setMidLineWidth(1);
00041
horizontalLine->setFrameStyle( QFrame::HLine | QFrame::Raised );
00042
00043
behavior =
new QVGroupBox( tr(
"Behavior"),
this);
00044
showDestructiveAlerts =
new QCheckBox( tr(
"Alert me to destructive actions"),
behavior);
00045
showSoftwareUpdateAlerts =
new QCheckBox( tr(
"Alert me to software updates"),
behavior);
00046
00047
grid =
new QGridLayout(
this, 4, 1, 0);
00048
grid->setSpacing(
WIDGET_SPACING );
00049
00050
grid->addWidget(
categoryLabel, 0, 0, Qt::AlignLeft );
00051
grid->addWidget(
horizontalLine, 1, 0 );
00052
grid->addWidget(
behavior, 2, 0 );
00053
grid->setRowStretch( 3, 1 );
00054 }
00055
00056 void AlertsWidget::setDefaults(
Configuration* config)
00057 {
00058 config->
setBool(
"alerts",
"showDestructiveAlerts",
true );
00059 config->
setBool(
"alerts",
"showSoftwareUpdateAlerts",
true );
00060 config->
setString(
"alerts",
"loadSaveDir", QString(
ALBUMSHAPER_VERSION) );
00061 }
00062
00063 void AlertsWidget::loadSettings()
00064 {
00065
showDestructiveAlerts->setChecked(
config->
getBool(
"alerts",
"showDestructiveAlerts" ));
00066
showSoftwareUpdateAlerts->setChecked(
config->
getBool(
"alerts",
"showSoftwareUpdateAlerts" ));
00067 }
00068
00069 void AlertsWidget::saveSettings()
00070 {
00071
config->
setBool(
"alerts",
"showDestructiveAlerts",
showDestructiveAlerts->isChecked() );
00072
config->
setBool(
"alerts",
"showSoftwareUpdateAlerts",
showSoftwareUpdateAlerts->isChecked() );
00073
00074
00075
if(
showSoftwareUpdateAlerts->isChecked())
00076 ((
Window*)qApp->mainWidget())->getStatus()->checkForUpdates();
00077
else
00078 ((
Window*)qApp->mainWidget())->getStatus()->removeUpdatesIcon();
00079 }
00080