{
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;