help me sir...
Added after 6 minutes:
ya this only i putd sir bt my problem is remote folder displaying only two images of evry 5 th minute,its not dispalying remaining images in remote folder.. can you pls check my code and rectify my problem plsss.
my coding
void Widget::ReadImagesfromlocalFolder()
{
QString filePath1
("/home/ishwarya/displayimages/configfile");
QString filePath2
("/home/ishwarya/displayimages/local");
QString sortedimagesfilenameslist
="temp.txt";
dir.cd(filePath1);
file.setFileName(dir.absoluteFilePath(sortedimagesfilenameslist));
for(int i=0;i<31;i++)
{
showFullScreen();
activateWindow();
imagefilename[i]= stream.readLine();
qDebug()<<"local:"<<imagefilename[i];
dir.cd(filePath2);
file1.setFileName(dir.absoluteFilePath(imagefilename[i]));
ImageToLoad.load(dir.absoluteFilePath(imagefilename[i]));
label
->setPixmap
(QPixmap::fromImage(ImageToLoad.
scaled(900,
900,Qt
::KeepAspectRatio,Qt
::FastTransformation)));
label->showFullScreen();
delay();
}
}
void Widget::ReadImagesfromRemoteFolder()
{
int j=0;
QString filePath1
("/home/ishwarya/displayimages/configfile");
QString filePath2
("/home/ishwarya/displayimages/remote");
QString sortedimagesfilenameslist
="tempp.txt";
dir.cd(filePath1);
file.setFileName(dir.absoluteFilePath(sortedimagesfilenameslist));
for(j=0;j<24;j++)
{
showFullScreen();
activateWindow();
imagefilename[j]= stream.readLine();
qDebug()<<"remote:"<<imagefilename[j];
dir.cd(filePath2);
file1.setFileName(dir.absoluteFilePath(imagefilename[j]));
ImageToLoad.load(dir.absoluteFilePath(imagefilename[j]));
label
->setPixmap
(QPixmap::fromImage(ImageToLoad.
scaled(900,
900,Qt
::KeepAspectRatio,Qt
::FastTransformation)));
label->showFullScreen();
delay();
ReadImagesfromlocalFolder();
}
}
void Widget::delay()
{
if((time.second() % 300 ) == 0)
{
ReadImagesfromRemoteFolder();
}
if(checklocalseconds=="local=10seconds")
{
sleepTime
= QTime::currentTime().
addSecs(10);
while(QTime::currentTime() < sleepTime
);
qDebug()<<"check";
}
}
void Widget::ReadImagesfromlocalFolder()
{
QString filePath1("/home/ishwarya/displayimages/configfile");
QString filePath2("/home/ishwarya/displayimages/local");
QString sortedimagesfilenameslist="temp.txt";
dir.cd(filePath1);
QFile file;
file.setFileName(dir.absoluteFilePath(sortedimagesfilenameslist));
file.open(QIODevice::ReadOnly);
QTextStream stream( &file );
QString imagefilename[100];
for(int i=0;i<31;i++)
{
showFullScreen();
activateWindow();
imagefilename[i]= stream.readLine();
qDebug()<<"local:"<<imagefilename[i];
dir.cd(filePath2);
QFile file1;
file1.setFileName(dir.absoluteFilePath(imagefilename[i]));
QImage ImageToLoad;
ImageToLoad.load(dir.absoluteFilePath(imagefilename[i]));
QLabel *label = new QLabel(this);
label->setPixmap(QPixmap::fromImage(ImageToLoad.scaled(900,900,Qt::KeepAspectRatio,Qt::FastTransformation)));
label->showFullScreen();
delay();
}
}
void Widget::ReadImagesfromRemoteFolder()
{
int j=0;
QString filePath1("/home/ishwarya/displayimages/configfile");
QString filePath2("/home/ishwarya/displayimages/remote");
QString sortedimagesfilenameslist="tempp.txt";
dir.cd(filePath1);
QFile file;
file.setFileName(dir.absoluteFilePath(sortedimagesfilenameslist));
file.open(QIODevice::ReadOnly);
QTextStream stream( &file );
QString imagefilename[24];
for(j=0;j<24;j++)
{
showFullScreen();
activateWindow();
imagefilename[j]= stream.readLine();
qDebug()<<"remote:"<<imagefilename[j];
dir.cd(filePath2);
QFile file1;
file1.setFileName(dir.absoluteFilePath(imagefilename[j]));
QImage ImageToLoad;
ImageToLoad.load(dir.absoluteFilePath(imagefilename[j]));
QLabel *label = new QLabel(this);
label->setPixmap(QPixmap::fromImage(ImageToLoad.scaled(900,900,Qt::KeepAspectRatio,Qt::FastTransformation)));
label->showFullScreen();
delay();
ReadImagesfromlocalFolder();
}
}
void Widget::delay()
{
QTime time = QTime::currentTime();
if((time.second() % 300 ) == 0)
{
ReadImagesfromRemoteFolder();
}
if(checklocalseconds=="local=10seconds")
{
sleepTime = QTime::currentTime().addSecs(10);
while(QTime::currentTime() < sleepTime);
qDebug()<<"check";
QApplication::processEvents(QEventLoop::AllEvents,1000);
}
}
To copy to clipboard, switch view to plain text mode

Originally Posted by
jthomps
There are 300 seconds in a minute, so not sure why you're modding the seconds by 5 and expecting that to equate to 5 minutes. Also, I don't know how your section of code is executed, but even if you change to:
if ((time.seconds() % 300) == 0)
if ((time.seconds() % 300) == 0)
To copy to clipboard, switch view to plain text mode
Your code would have to execute exactly on every 5th minute or else you'd miss the window until the next 5 minute (300 seconds) interval. You really should use a
QTimer here IMHO.
Bookmarks