#############################################################################
# Makefile for building: bootscreen
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Mon Feb 22 01:04:53 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun Feb 28 16:52:17 2010
# Project: bootscreen.pro
# Template: app
# Command: /opt/qt4-maemo5/bin/qmake-qt4 -unix -o Makefile bootscreen.pro
{
hildonWelcome = "/etc/hildon-welcome.d/";
videosDir = "/opt/bootscreen/media/";
+ settingsDir = "/opt/bootscreen/data/";
checkSettings();
filterGroup = new QActionGroup(this);
void BootScreen::checkSettings()
{
- QDir dir("/home/user");
- if (!dir.cd(".bootscreen")) {
- qWarning("Cannot find the \".bootscreen/\" directory");
- dir.mkdir(".bootscreen");
- if (!dir.cd(".bootscreen")) {
- qWarning("Cannot create the \".bootscreen/\" directory");
-
- //terminar applicacao
- }
- }
- settingsFile.setFileName(dir.filePath("settings.ini"));
- if (!settingsFile.exists())
+ QDir dir(settingsDir);
+ settingsFile.setFileName(dir.filePath("bootscrenn.conf"));
+
+ if (!settingsFile.exists())
restoreSettings();
- else{
+ else{
QSettings tempSettings(settingsFile.fileName(),QSettings::IniFormat);
random = tempSettings.value("random").toBool();
- }
+ }
}
void BootScreen::createList()
QMaemo5InformationBox::DefaultTimeout);
else{
bool result = fileCopy.copy(newFilePath);
- // tamanho
- if(result)
+ if(result){
list->addItem(QString("%1").arg(fileInfo.fileName()));
+ //autoselect item, if not in random mode
+ if(!random){
+ QListWidgetItem *currentItem = list->item(list->count()-1);
+ currentItem->setSelected(true);
+ }
+ }
else
QMaemo5InformationBox::information(this, "<font color=black>Error copying file</font>",
QMaemo5InformationBox::DefaultTimeout);
}
}
-
- //add somewhere
}
}
{
qDebug() << settingsFile.fileName() << endl;
- if (!settingsFile.open(QIODevice::ReadWrite | QIODevice::Text))
+ if (!settingsFile.open(QIODevice::ReadWrite | QIODevice::Text)){
qWarning("Cannot create the settings file"); //abord
+ QMaemo5InformationBox::information(this, "<font color=black><b>Error:</b> Cannot create the settings file</font>",
+ QMaemo5InformationBox::DefaultTimeout);
+ }
QTextStream out(&settingsFile);
out << "random=false" << endl;
install_app.commands = $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)/opt/bootscreen/$(QMAKE_TARGET)
+install_cfg.commands = $(INSTALL_FILE) data/$(QMAKE_TARGET).conf $(DESTDIR)/opt/bootscreen/$(QMAKE_TARGET).conf
install_dsk.commands = $(INSTALL_FILE) data/$(QMAKE_TARGET).desktop $(DESTDIR)/usr/share/applications/hildon/$(QMAKE_TARGET).desktop
install_sd.commands = $(INSTALL_FILE) data/$(QMAKE_TARGET).sudoers $(DESTDIR)/etc/sudoers.d/$(QMAKE_TARGET).sudoers
install_evd.commands = $(INSTALL_FILE) data/$(QMAKE_TARGET) $(DESTDIR)/etc/event.d/$(QMAKE_TARGET)
BootScreenR::BootScreenR()
{
- logFile.setFileName("/home/user/.bootscreen/log.txt");
+ settingsDir = "/opt/bootscreen/data/";
+ logFile.setFileName("/opt/bootscreen/data/log.txt");
if (!logFile.open(QIODevice::ReadWrite | QIODevice::Text))
qDebug() << "Can't write log" << endl;
QTextStream out(&logFile);
- out << "log" << endl;
+ //out << "log" << endl;
QDir dir("/home/user/");
- if (dir.cd(".bootscreen")) {
- settingsFile.setFileName(dir.filePath("settings.ini"));
- if (settingsFile.exists()){
- QSettings tempSettings(settingsFile.fileName(),QSettings::IniFormat);
- bool random = tempSettings.value("random").toBool();
- if(random)
- selectRandomFile();
- }
- else
- out << "Can't read settings file1111" << endl;
- }
- else
- out << "Can't read settings file2222" << endl;
+ settingsFile.setFileName(dir.filePath("settings.ini"));
+ if (settingsFile.exists()){
+ QSettings tempSettings(settingsFile.fileName(),QSettings::IniFormat);
+ bool random = tempSettings.value("random").toBool();
+ if(random)
+ selectRandomFile();
+ }
+ else
+ out << "Can't read settings file" << endl;
}
void BootScreenR::selectRandomFile()