projects
/
jspeed
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fa66fb3
)
Some fixes to setting dialogs.
author
eshe
<jessehakanen@gmail.com>
Mon, 26 Jul 2010 17:08:44 +0000
(18:08 +0100)
committer
eshe
<jessehakanen@gmail.com>
Mon, 26 Jul 2010 17:08:44 +0000
(18:08 +0100)
src/buttonselector.cpp
patch
|
blob
|
history
src/buttonselector.h
patch
|
blob
|
history
src/mainwindow.cpp
patch
|
blob
|
history
src/poiascreader.cpp
patch
|
blob
|
history
src/poisettings.cpp
patch
|
blob
|
history
src/themescheduler.cpp
patch
|
blob
|
history
src/themescheduler.h
patch
|
blob
|
history
src/themeschedulersettings.cpp
patch
|
blob
|
history
src/themeschedulersettings.h
patch
|
blob
|
history
src/themeselector.cpp
patch
|
blob
|
history
src/themeselector.h
patch
|
blob
|
history
diff --git
a/src/buttonselector.cpp
b/src/buttonselector.cpp
index
22fa6d4
..
50e8e6e
100644
(file)
--- a/
src/buttonselector.cpp
+++ b/
src/buttonselector.cpp
@@
-149,5
+149,5
@@
int ButtonSelector::size() const
void ButtonSelector::onSelected(QString const& text)
{
void ButtonSelector::onSelected(QString const& text)
{
- emit selected(currentIndex(), text, value());
+ emit selected();
}
}
diff --git
a/src/buttonselector.h
b/src/buttonselector.h
index
6b92b24
..
05213be
100644
(file)
--- a/
src/buttonselector.h
+++ b/
src/buttonselector.h
@@
-48,7
+48,7
@@
public:
QVariant value() const;
signals:
QVariant value() const;
signals:
- void selected(unsigned int index, QString const& text, QVariant const& value);
+ void selected();
private slots:
void onSelected(QString const& text);
private slots:
void onSelected(QString const& text);
diff --git
a/src/mainwindow.cpp
b/src/mainwindow.cpp
index
d30e299
..
3ccacaf
100644
(file)
--- a/
src/mainwindow.cpp
+++ b/
src/mainwindow.cpp
@@
-37,7
+37,7
@@
MainWindow::MainWindow(): QMainWindow(0), menu_(0), themeLoader_(0), mainScreen_
setWindowTitle(tr("jSpeed"));
showFullScreen();
addScreens();
setWindowTitle(tr("jSpeed"));
showFullScreen();
addScreens();
- QTimer::singleShot(500, this, SLOT(loadServices()));
+ QTimer::singleShot(800, this, SLOT(loadServices()));
}
MainWindow::~MainWindow()
}
MainWindow::~MainWindow()
diff --git
a/src/poiascreader.cpp
b/src/poiascreader.cpp
index
19e9e82
..
68bb048
100644
(file)
--- a/
src/poiascreader.cpp
+++ b/
src/poiascreader.cpp
@@
-29,6
+29,8
@@
PoiAscReader::PoiAscReader(QString filename): PoiReader(), filename_(filename)
bool PoiAscReader::read(QList<Poi>& pois)
{
bool PoiAscReader::read(QList<Poi>& pois)
{
+ pois.clear();
+
QFile file(filename_);
if(!file.open(QIODevice::ReadOnly))
QFile file(filename_);
if(!file.open(QIODevice::ReadOnly))
diff --git
a/src/poisettings.cpp
b/src/poisettings.cpp
index
5adfa6e
..
5601c23
100644
(file)
--- a/
src/poisettings.cpp
+++ b/
src/poisettings.cpp
@@
-141,11
+141,13
@@
void PoiSettings::saveSettings()
Settings::instance().setValue("alert_sound", soundSelector_->value());
Settings::instance().setValue("alert_poi_file", poiFileSelector_->value());
Settings::instance().setValue("alert_sound", soundSelector_->value());
Settings::instance().setValue("alert_poi_file", poiFileSelector_->value());
- hide();
-
if(!PoiAlerts::instance().loadConfig())
{
if(!PoiAlerts::instance().loadConfig())
{
- QMaemo5InformationBox::information(0, tr("Unable to load poi file: %1.").arg(PoiAlerts::instance().error()),
+ QMaemo5InformationBox::information(this, tr("Unable to load poi file: %1.").arg(PoiAlerts::instance().error()),
QMaemo5InformationBox::NoTimeout);
}
QMaemo5InformationBox::NoTimeout);
}
+ else
+ {
+ hide();
+ }
}
}
diff --git
a/src/themescheduler.cpp
b/src/themescheduler.cpp
index
a09225f
..
c8f939a
100644
(file)
--- a/
src/themescheduler.cpp
+++ b/
src/themescheduler.cpp
@@
-203,3
+203,8
@@
void ThemeScheduler::emitThemeChanged()
emit themeChanged();
}
}
emit themeChanged();
}
}
+
+bool ThemeScheduler::isEmpty() const
+{
+ return items_.isEmpty();
+}
diff --git
a/src/themescheduler.h
b/src/themescheduler.h
index
0501964
..
be82fb4
100644
(file)
--- a/
src/themescheduler.h
+++ b/
src/themescheduler.h
@@
-48,6
+48,7
@@
public:
QString currentTheme() const;
void clear();
void getItems(QList<SchedulerItem>& items);
QString currentTheme() const;
void clear();
void getItems(QList<SchedulerItem>& items);
+ bool isEmpty() const;
public slots:
void store();
public slots:
void store();
diff --git
a/src/themeschedulersettings.cpp
b/src/themeschedulersettings.cpp
index
d03a449
..
c545b58
100644
(file)
--- a/
src/themeschedulersettings.cpp
+++ b/
src/themeschedulersettings.cpp
@@
-27,6
+27,7
@@
#include <QtGui/QDialogButtonBox>
#include <QtGui/QPushButton>
#include <QtGui/QListWidget>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QPushButton>
#include <QtGui/QListWidget>
+#include <QMaemo5InformationBox>
#include <QMaemo5ValueButton>
#include <QMaemo5TimePickSelector>
#include "themeschedulersettings.h"
#include <QMaemo5ValueButton>
#include <QMaemo5TimePickSelector>
#include "themeschedulersettings.h"
@@
-175,8
+176,21
@@
void ThemeSchedulerSettings::loadItems()
void ThemeSchedulerSettings::saveSettings()
{
void ThemeSchedulerSettings::saveSettings()
{
- ThemeScheduler::instance().setEnabled(enabled_->isChecked());
+ bool enabled = enabled_->isChecked();
+
+ if(enabled && ThemeScheduler::instance().isEmpty())
+ {
+ QMaemo5InformationBox::information(this, tr("Theme scheduler is empty."));
+ return;
+ }
+
+ ThemeScheduler::instance().setEnabled(enabled);
hide();
hide();
+
+ if(enabled)
+ {
+ emit themeChanged();
+ }
}
void ThemeSchedulerSettings::showContextMenu(QPoint const& point)
}
void ThemeSchedulerSettings::showContextMenu(QPoint const& point)
@@
-213,3
+227,13
@@
void ThemeSchedulerSettings::removeSelection()
itemList_->clearSelection();
}
}
itemList_->clearSelection();
}
}
+
+void ThemeSchedulerSettings::setVisible(bool visible)
+{
+ if(visible)
+ {
+ enabled_->setChecked(ThemeScheduler::instance().isEnabled());
+ }
+
+ QDialog::setVisible(visible);
+}
diff --git
a/src/themeschedulersettings.h
b/src/themeschedulersettings.h
index
c4a4fcd
..
3961fd4
100644
(file)
--- a/
src/themeschedulersettings.h
+++ b/
src/themeschedulersettings.h
@@
-37,6
+37,12
@@
class ThemeSchedulerSettings : public QDialog
public:
ThemeSchedulerSettings(QWidget* parent = 0);
public:
ThemeSchedulerSettings(QWidget* parent = 0);
+signals:
+ void themeChanged();
+
+protected:
+ void setVisible(bool visible);
+
private slots:
void openAddDialog();
void addScheduledTheme();
private slots:
void openAddDialog();
void addScheduledTheme();
diff --git
a/src/themeselector.cpp
b/src/themeselector.cpp
index
9f377ac
..
b64548f
100644
(file)
--- a/
src/themeselector.cpp
+++ b/
src/themeselector.cpp
@@
-26,6
+26,7
@@
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include <QtGui/QMessageBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include <QtGui/QMessageBox>
+#include <QMaemo5InformationBox>
#include "themeselector.h"
#include "themepicker.h"
#include "themeloader.h"
#include "themeselector.h"
#include "themepicker.h"
#include "themeloader.h"
@@
-48,7
+49,7
@@
ThemeSelector::ThemeSelector(QWidget* parent): QDialog(parent), themeScheduler_(
buttons->addButton(saveButton, QDialogButtonBox::AcceptRole);
selector_ = new ThemePicker(tr("Theme"), this);
buttons->addButton(saveButton, QDialogButtonBox::AcceptRole);
selector_ = new ThemePicker(tr("Theme"), this);
- theme_ = Settings::instance().value("theme", "default").toString();
+ connect(selector_, SIGNAL(selected()), this, SLOT(disableScheduler()));
QPushButton* loadButton = new QPushButton(tr("Import"));
connect(loadButton, SIGNAL(clicked(bool)), this, SLOT(loadFromFile()));
QPushButton* loadButton = new QPushButton(tr("Import"));
connect(loadButton, SIGNAL(clicked(bool)), this, SLOT(loadFromFile()));
@@
-72,16
+73,8
@@
ThemeSelector::ThemeSelector(QWidget* parent): QDialog(parent), themeScheduler_(
void ThemeSelector::saveTheme()
{
QString theme = selector_->value().toString();
void ThemeSelector::saveTheme()
{
QString theme = selector_->value().toString();
-
- if(theme == theme_)
- {
- hide();
- return;
- }
-
Settings::instance().setValue("theme", theme);
hide();
Settings::instance().setValue("theme", theme);
hide();
- theme_ = theme;
emit themeChanged();
}
emit themeChanged();
}
@@
-105,7
+98,17
@@
void ThemeSelector::openScheduler()
if(!themeScheduler_)
{
themeScheduler_ = new ThemeSchedulerSettings(this);
if(!themeScheduler_)
{
themeScheduler_ = new ThemeSchedulerSettings(this);
+ connect(themeScheduler_, SIGNAL(themeChanged()), this, SIGNAL(themeChanged()));
}
themeScheduler_->show();
}
}
themeScheduler_->show();
}
+
+void ThemeSelector::disableScheduler()
+{
+ if(ThemeScheduler::instance().isEnabled())
+ {
+ QMaemo5InformationBox::information(this, tr("Disabling theme scheduler..."), 1000);
+ ThemeScheduler::instance().setEnabled(false);
+ }
+}
diff --git
a/src/themeselector.h
b/src/themeselector.h
index
ec5f943
..
1f6fac2
100644
(file)
--- a/
src/themeselector.h
+++ b/
src/themeselector.h
@@
-39,10
+39,10
@@
private slots:
void saveTheme();
void loadFromFile();
void openScheduler();
void saveTheme();
void loadFromFile();
void openScheduler();
+ void disableScheduler();
private:
ThemePicker* selector_;
private:
ThemePicker* selector_;
- QString theme_;
ThemeSchedulerSettings* themeScheduler_;
};
ThemeSchedulerSettings* themeScheduler_;
};