void ButtonSelector::onSelected(QString const& text)
{
- emit selected(currentIndex(), text, value());
+ emit selected();
}
QVariant value() const;
signals:
- void selected(unsigned int index, QString const& text, QVariant const& value);
+ void selected();
private slots:
void onSelected(QString const& text);
setWindowTitle(tr("jSpeed"));
showFullScreen();
addScreens();
- QTimer::singleShot(500, this, SLOT(loadServices()));
+ QTimer::singleShot(800, this, SLOT(loadServices()));
}
MainWindow::~MainWindow()
bool PoiAscReader::read(QList<Poi>& pois)
{
+ pois.clear();
+
QFile file(filename_);
if(!file.open(QIODevice::ReadOnly))
Settings::instance().setValue("alert_sound", soundSelector_->value());
Settings::instance().setValue("alert_poi_file", poiFileSelector_->value());
- hide();
-
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);
}
+ else
+ {
+ hide();
+ }
}
emit themeChanged();
}
}
+
+bool ThemeScheduler::isEmpty() const
+{
+ return items_.isEmpty();
+}
QString currentTheme() const;
void clear();
void getItems(QList<SchedulerItem>& items);
+ bool isEmpty() const;
public slots:
void store();
#include <QtGui/QDialogButtonBox>
#include <QtGui/QPushButton>
#include <QtGui/QListWidget>
+#include <QMaemo5InformationBox>
#include <QMaemo5ValueButton>
#include <QMaemo5TimePickSelector>
#include "themeschedulersettings.h"
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();
+
+ if(enabled)
+ {
+ emit themeChanged();
+ }
}
void ThemeSchedulerSettings::showContextMenu(QPoint const& point)
itemList_->clearSelection();
}
}
+
+void ThemeSchedulerSettings::setVisible(bool visible)
+{
+ if(visible)
+ {
+ enabled_->setChecked(ThemeScheduler::instance().isEnabled());
+ }
+
+ QDialog::setVisible(visible);
+}
public:
ThemeSchedulerSettings(QWidget* parent = 0);
+signals:
+ void themeChanged();
+
+protected:
+ void setVisible(bool visible);
+
private slots:
void openAddDialog();
void addScheduledTheme();
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include <QtGui/QMessageBox>
+#include <QMaemo5InformationBox>
#include "themeselector.h"
#include "themepicker.h"
#include "themeloader.h"
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()));
void ThemeSelector::saveTheme()
{
QString theme = selector_->value().toString();
-
- if(theme == theme_)
- {
- hide();
- return;
- }
-
Settings::instance().setValue("theme", theme);
hide();
- theme_ = theme;
emit themeChanged();
}
if(!themeScheduler_)
{
themeScheduler_ = new ThemeSchedulerSettings(this);
+ connect(themeScheduler_, SIGNAL(themeChanged()), this, SIGNAL(themeChanged()));
}
themeScheduler_->show();
}
+
+void ThemeSelector::disableScheduler()
+{
+ if(ThemeScheduler::instance().isEnabled())
+ {
+ QMaemo5InformationBox::information(this, tr("Disabling theme scheduler..."), 1000);
+ ThemeScheduler::instance().setEnabled(false);
+ }
+}
void saveTheme();
void loadFromFile();
void openScheduler();
+ void disableScheduler();
private:
ThemePicker* selector_;
- QString theme_;
ThemeSchedulerSettings* themeScheduler_;
};