1 #include "bootscreenR.h"
8 BootScreenR::BootScreenR()
10 logFile.setFileName("/home/user/.bootscreen/log.txt");
12 if (!logFile.open(QIODevice::ReadWrite | QIODevice::Text))
13 qDebug() << "Can't write log" << endl;
15 QTextStream out(&logFile);
17 QDir dir("/home/user/");
18 if (dir.cd(".bootscreen")) {
19 settingsFile.setFileName(dir.filePath("settings.ini"));
20 if (settingsFile.exists()){
21 QSettings tempSettings(settingsFile.fileName(),QSettings::IniFormat);
22 bool random = tempSettings.value("random").toBool();
27 out << "Can't read settings file1111" << endl;
30 out << "Can't read settings file2222" << endl;
34 void BootScreenR::selectRandomFile()
36 QTextStream out(&logFile);
38 QSettings settings("/etc/hildon-welcome.d/0.conf",QSettings::IniFormat);
39 if (!settings.isWritable())
40 out << "Can't Write hildon-welcome settings" << endl;
43 settings.beginGroup("hildon-welcome");
44 QString currentFile = settings.value("filename").toString();
46 QDir videosDir("/opt/bootscreen/media");
47 videosDir.setFilter(QDir::Files | QDir::NoSymLinks);
48 videosDir.setSorting(QDir::Name);
49 QFileInfoList ls = videosDir.entryInfoList();
50 for (int i = 0; i < ls.size(); ++i) {
51 QFileInfo fileInfo = ls.at(i);
52 if(fileInfo.absoluteFilePath() != currentFile)
53 files.append(fileInfo.absoluteFilePath());
57 QTime fixTime(0, 0, 0);
58 qsrand(fixTime.secsTo(QTime::currentTime()));
59 int randomNumb = qrand() % files.size();
60 settings.setValue("filename", files.at(randomNumb));
63 out << "Can't randomize: Only one file in the media directory." << endl;
67 BootScreenR::~BootScreenR()