X-Git-Url: http://git.maemo.org/git/?p=bootcreen;a=blobdiff_plain;f=bootscreen.cpp;h=ae1a04b0ca13835e43ca74f3e32e3b2848e34453;hp=fca329f30fa33c50f923b21ad0a5aaf674a203fb;hb=3ec4cdf81a3d1bef3206718b710096fbf7036175;hpb=66b37c1589d92dd3b0db06902794c3f10ece5a7e
diff --git a/bootscreen.cpp b/bootscreen.cpp
index fca329f..ae1a04b 100644
--- a/bootscreen.cpp
+++ b/bootscreen.cpp
@@ -7,6 +7,7 @@ BootScreen::BootScreen(QWidget *parent)
{
hildonWelcome = "/etc/hildon-welcome.d/";
videosDir = "/opt/bootscreen/media/";
+ settingsDir = "/opt/bootscreen/data/";
checkSettings();
filterGroup = new QActionGroup(this);
@@ -36,23 +37,15 @@ BootScreen::BootScreen(QWidget *parent)
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()
@@ -174,16 +167,19 @@ void BootScreen::addVideo()
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, "Error copying file",
QMaemo5InformationBox::DefaultTimeout);
}
}
-
- //add somewhere
}
}
@@ -281,8 +277,11 @@ void BootScreen::restoreSettings()
{
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, "Error: Cannot create the settings file",
+ QMaemo5InformationBox::DefaultTimeout);
+ }
QTextStream out(&settingsFile);
out << "random=false" << endl;