Commit dc884e58 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Using QDir::separator() instead of hard-coded platform-dependent / separator

parent e05b9801
......@@ -18,6 +18,7 @@
#include "colorscheme.h"
#include <QFile>
#include <QDir>
#include <QTextStream>
#include <kconfig.h>
......@@ -232,7 +233,7 @@ bool ColorScheme::save( const QString &name ) {
if ( filename.at(i)==' ' ) filename.replace( i, 1, "-" );
filename = filename.append( ".colors" );
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + filename ) ; //determine filename in local user KDE directory tree.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + filename ) ; //determine filename in local user KDE directory tree.
if ( file.exists() || !file.open( QIODevice::ReadWrite | QIODevice::Append ) ) {
QString message = i18n( "Local color scheme file could not be opened.\nScheme cannot be recorded." );
......@@ -247,7 +248,7 @@ bool ColorScheme::save( const QString &name ) {
file.close();
}
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "colors.dat" ) ; //determine filename in local user KDE directory tree.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "colors.dat" ) ; //determine filename in local user KDE directory tree.
if ( !file.open( QIODevice::ReadWrite | QIODevice::Append ) ) {
QString message = i18n( "Local color scheme index file could not be opened.\nScheme cannot be recorded." );
......
......@@ -187,7 +187,7 @@ QList<FOV*> FOV::defaults()
void FOV::writeFOVs(const QList<FOV*> fovs)
{
QFile f;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "fov.dat" ) ;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "fov.dat" ) ;
if ( ! f.open( QIODevice::WriteOnly ) ) {
qDebug() << "Could not open fov.dat.";
......@@ -211,7 +211,7 @@ QList<FOV*> FOV::readFOVs()
{
QFile f;
QList<FOV*> fovs;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "fov.dat" ) ;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "fov.dat" ) ;
if( !f.exists() ) {
fovs = defaults();
......
......@@ -183,7 +183,7 @@ bool ImageExporter::exportImage( QString url )
//If the filename string contains no "/" separators, assume the
//user wanted to place a file in their home directory.
QUrl fileURL;
if(!url.contains("/"))
if(!url.contains(QDir::separator()))
{
fileURL = QDir::homePath() + '/' + url;
}
......
......@@ -35,7 +35,7 @@
bool KSUserDB::Initialize() {
// Every logged in user has their own db.
userdb_ = QSqlDatabase::addDatabase("QSQLITE", "userdb");
QString dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "userdb.sqlite";
QString dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "userdb.sqlite";
QFile testdb(dbfile);
bool first_run = false;
if (!testdb.exists()) {
......@@ -706,7 +706,7 @@ void KSUserDB::GetAllFilters(QList<OAL::Filter *> &filter_list) {
#if 0
bool KSUserDB::ImportFlags() {
QString flagfilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "flags.dat";
QString flagfilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "flags.dat";
QFile flagsfile(flagfilename);
if (!flagsfile.exists()) {
return false; // No upgrade needed. Flags file doesn't exist.
......@@ -737,7 +737,7 @@ bool KSUserDB::ImportFlags() {
}
bool KSUserDB::ImportUsers() {
QString usersfilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "observerlist.xml";
QString usersfilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "observerlist.xml";
QFile usersfile(usersfilename);
if (!usersfile.exists()) {
......@@ -798,7 +798,7 @@ bool KSUserDB::ImportUsers() {
}
bool KSUserDB::ImportEquipment() {
QString equipfilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "equipmentlist.xml";
QString equipfilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "equipmentlist.xml";
QFile equipfile(equipfilename);
if (!equipfile.exists()) {
......
......@@ -611,7 +611,7 @@ void DetailDialog::addLink() {
//Also, update the user's custom image links database
//check for user's image-links database. If it doesn't exist, create it.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "image_url.dat" ) ; //determine filename in local user KDE directory tree.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "image_url.dat" ) ; //determine filename in local user KDE directory tree.
if ( !file.open( QIODevice::ReadWrite | QIODevice::Append ) ) {
QString message = i18n( "Custom image-links file could not be opened.\nLink cannot be recorded for future sessions." );
......@@ -630,7 +630,7 @@ void DetailDialog::addLink() {
selectedObject->InfoTitle().append( adialog->desc() );
//check for user's image-links database. If it doesn't exist, create it.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "info_url.dat" ) ; //determine filename in local user KDE directory tree.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "info_url.dat" ) ; //determine filename in local user KDE directory tree.
if ( !file.open( QIODevice::ReadWrite | QIODevice::Append ) ) {
QString message = i18n( "Custom information-links file could not be opened.\nLink cannot be recorded for future sessions." );
......@@ -925,13 +925,13 @@ void DetailDialog::updateLocalDatabase(int type, const QString &search_line, con
// Info Links
case 0:
// Get name for our local info_url file
URLFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "info_url.dat" ) ;
URLFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "info_url.dat" ) ;
break;
// Image Links
case 1:
// Get name for our local info_url file
URLFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "image_url.dat" ) ;
URLFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "image_url.dat" ) ;
break;
}
......@@ -1158,7 +1158,7 @@ void DetailDialog::updateThumbnail() {
QPointer<ThumbnailPicker> tp = new ThumbnailPicker( selectedObject, *Thumbnail, this );
if ( tp->exec() == QDialog::Accepted ) {
QString fname = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "thumb-" + selectedObject->name().toLower().remove( ' ' ) + ".png" ;
QString fname = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "thumb-" + selectedObject->name().toLower().remove( ' ' ) + ".png" ;
Data->Image->setPixmap( *(tp->image()) );
......
......@@ -303,7 +303,7 @@ bool LocationDialog::updateCity(CityOperation operation)
}*/
QSqlDatabase mycitydb = QSqlDatabase::database("mycitydb");
QString dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + "mycitydb.sqlite";
QString dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "mycitydb.sqlite";
// If it doesn't exist, create it
if (QFile::exists(dbfile) == false)
......
......@@ -1101,7 +1101,7 @@ void Capture::checkSeqBoundary(const QString &path)
while (it.hasNext())
{
tempName = it.next();
tempName.remove(path + "/");
tempName.remove(path + QDir::separator());
// find the prefix first
//if (tempName.startsWith(seqPrefix) == false || tempName.endsWith(".fits") == false)
......
......@@ -955,7 +955,7 @@ bool DriverManager::readXMLDrivers()
if (fileInfo.fileName() == "drivers.xml")
{
// Let first attempt to load the local version of drivers.xml
driverName = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "drivers.xml";
driverName = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "drivers.xml";
// If found, we continue, otherwise, we load the system file
if (driverName.isEmpty() == false && QFile(driverName).exists())
......@@ -1436,7 +1436,7 @@ void DriverManager::saveHosts()
QFile file;
QString hostData;
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "indihosts.xml" ) ; //determine filename in local user KDE directory tree.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "indihosts.xml" ) ; //determine filename in local user KDE directory tree.
if ( !file.open( QIODevice::WriteOnly))
{
......
......@@ -1190,7 +1190,7 @@ void CCD::processBLOB(IBLOB* bp)
{
QProcess dcraw;
QString rawFileName = filename;
rawFileName = rawFileName.remove(0, rawFileName.lastIndexOf("/"));
rawFileName = rawFileName.remove(0, rawFileName.lastIndexOf(QDir::separator()));
QString templateName = QString("%1/%2.XXXXXX").arg(QDir::tempPath()).arg(rawFileName);
QTemporaryFile jpgPreview(templateName);
jpgPreview.setAutoRemove(false);
......
......@@ -156,7 +156,7 @@ bool ServerManager::startDriver(DriverInfo *dv)
if (dv->getUniqueLabel().isEmpty() == false)
out << " -n \"" << dv->getUniqueLabel() << "\"";
if (dv->getSkeletonFile().isEmpty() == false)
out << " -s \"" << Options::indiDriversDir() << "/" << dv->getSkeletonFile() << "\"";
out << " -s \"" << Options::indiDriversDir() << QDir::separator() << dv->getSkeletonFile() << "\"";
out << endl;
out.flush();
......
......@@ -345,7 +345,7 @@ bool KStarsData::readCityData()
{
QSqlDatabase citydb = QSqlDatabase::addDatabase("QSQLITE", "citydb");
QString dbfile = QStandardPaths::locate(QStandardPaths::DataLocation, "citydb.sqlite");
//QString dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "citydb.sqlite";
//QString dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "citydb.sqlite";
citydb.setDatabaseName(dbfile);
if (citydb.open() == false)
{
......@@ -382,7 +382,7 @@ bool KStarsData::readCityData()
// Reading local database
QSqlDatabase mycitydb = QSqlDatabase::addDatabase("QSQLITE", "mycitydb");
dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + "mycitydb.sqlite";
dbfile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "mycitydb.sqlite";
if (QFile::exists(dbfile))
{
......@@ -457,7 +457,7 @@ bool KStarsData::openUrlFile(const QString &urlfile, QFile & file) {
fileFound = true;
} else {
// Try to load locale file, if not successful, load regular urlfile and then copy it to locale.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + urlfile ) ;
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + urlfile ) ;
if ( file.open( QIODevice::ReadOnly ) ) {
//local file found. Now, if global file has newer timestamp, then merge the two files.
//First load local file into QStringList
......@@ -533,7 +533,7 @@ bool KStarsData::openUrlFile(const QString &urlfile, QFile & file) {
if ( QLocale().language() != QLocale::English )
qDebug() << "No localized URL file; using default English file.";
// we found urlfile, we need to copy it to locale
localeFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + urlfile ) ;
localeFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + urlfile ) ;
if (localeFile.open(QIODevice::WriteOnly)) {
QTextStream readStream(&file);
QTextStream writeStream(&localeFile);
......
......@@ -90,7 +90,7 @@ void OpsAdvanced::slotToggleOutputOptions()
kcfg_VerboseLogFile->setEnabled(true);
if (kcfg_VerboseLogFile->text().isEmpty())
kcfg_VerboseLogFile->setText(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "kstars.log");
kcfg_VerboseLogFile->setText(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "kstars.log");
if (kcfg_DisableLogging->isChecked() == false)
KSUtils::Logging::UseFile(kcfg_VerboseLogFile->text());
......
......@@ -137,7 +137,7 @@ bool OpsColors::setColors( const QString &filename ) {
//check if colorscheme is removable...
QFile test;
test.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + filename ) ; //try filename in local user KDE directory tree.
test.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + filename ) ; //try filename in local user KDE directory tree.
if ( test.exists() ) RemovePreset->setEnabled( true );
else RemovePreset->setEnabled( false );
test.close();
......@@ -190,7 +190,7 @@ void OpsColors::slotRemovePreset() {
QString name = current->text();
QString filename = PresetFileList[ PresetBox->currentRow() ];
QFile cdatFile;
cdatFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "colors.dat" ) ; //determine filename in local user KDE directory tree.
cdatFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "colors.dat" ) ; //determine filename in local user KDE directory tree.
//Remove action from color-schemes menu
KStars::Instance()->removeColorMenuItem( QString("cs_" + filename.left( filename.indexOf(".colors"))).toUtf8() );
......@@ -219,7 +219,7 @@ void OpsColors::slotRemovePreset() {
if ( removed ) { //Entry was removed; delete the corresponding .colors file.
QFile colorFile;
colorFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + filename ) ; //determine filename in local user KDE directory tree.
colorFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + filename ) ; //determine filename in local user KDE directory tree.
if ( !colorFile.remove() ) {
QString message = i18n( "Could not delete the file: %1", colorFile.fileName() );
KMessageBox::sorry( 0, message, i18n( "Error Deleting File" ) );
......
......@@ -123,7 +123,7 @@ void FovEditorDialog::slotSaveImage()
//user wanted to place a file in their home directory.
QString url = QFileDialog::getSaveFileUrl(KStars::Instance(), i18n("Save Image"), QUrl(QDir::homePath()), "image/png image/jpeg image/gif image/x-portable-pixmap image/bmp").url();
QUrl fileUrl;
if(!url.contains("/"))
if(!url.contains(QDir::separator()))
{
fileUrl = QDir::homePath() + '/' + url;
}
......
......@@ -93,7 +93,7 @@ void PWizPrintUI::slotExport()
}
QString urlStr = url.url();
if(!urlStr.contains("/"))
if(!urlStr.contains(QDir::separator()))
{
urlStr = QDir::homePath() + '/' + urlStr;
}
......
......@@ -265,7 +265,7 @@ void AsteroidsComponent::updateDataFile() {
data.insert( 0, '#' );
// Write data to asteroids.dat
QFile file( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "asteroids.dat" ) ;
QFile file( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "asteroids.dat" ) ;
file.open( QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text );
file.write( data );
file.close();
......
......@@ -227,7 +227,7 @@ void CometsComponent::updateDataFile()
data.insert( 0, '#' );
// Write data to comets.dat
QFile file( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "comets.dat" ) ;
QFile file( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "comets.dat" ) ;
file.open( QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text );
file.write( data );
file.close();
......
......@@ -318,7 +318,7 @@ void DeepSkyComponent::loadData()
void DeepSkyComponent::mergeSplitFiles() {
//If user has downloaded the Steinicke NGC/IC catalog, then it is
//split into multiple files. Concatenate these into a single file.
QString firstFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "ngcic01.dat";
QString firstFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "ngcic01.dat";
if ( ! QFile::exists( firstFile ) ) return;
QDir localDir = QFileInfo( firstFile ).absoluteDir();
QStringList catFiles = localDir.entryList( QStringList( "ngcic??.dat" ) );
......
......@@ -226,7 +226,7 @@ void SupernovaeComponent::notifyNewSupernovae()
void SupernovaeComponent::slotTriggerDataFileUpdate()
{
QString output = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "supernovae.dat";
QString output = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "supernovae.dat";
QString filename= QStandardPaths::locate(QStandardPaths::DataLocation, "scripts/supernova_updates_parser.py") ;
QStringList args;
args << filename << output;
......
......@@ -80,7 +80,7 @@ KSComet::KSComet( const QString &_s, const QString &imfile,
P = 365.2568984 * pow(a, 1.5); //period in days
//If the name contains a "/", make this name2 and make name a truncated version without the leading "P/" or "C/"
if ( name().contains( "/" ) ) {
if ( name().contains( QDir::separator() ) ) {
setLongName( name() );
setName(name().replace("P/", " ").trimmed());
setName(name().remove("C/"));
......
......@@ -16,6 +16,7 @@
***************************************************************************/
#include <QFile>
#include <QDir>
#include <QStandardPaths>
#include "satellitegroup.h"
......@@ -80,7 +81,7 @@ void SatelliteGroup::updateSatellitesPos()
QUrl SatelliteGroup::tleFilename()
{
// Return absolute path with "file:" before the path
return QUrl( "file:" + (QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "") + m_tle_file) ;
return QUrl( "file:" + (QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "") + m_tle_file) ;
}
QUrl SatelliteGroup::tleUrl()
......
......@@ -438,7 +438,7 @@ void SkyObject::saveUserLog( const QString &newLog ) {
KSLabel = "[KSLABEL:" + star->gname( false ) + ']'; //"false": spell out greek letter
}
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "userlog.dat" ) ; //determine filename in local user KDE directory tree.
file.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "userlog.dat" ) ; //determine filename in local user KDE directory tree.
if ( file.open( QIODevice::ReadOnly)) {
QTextStream instream(&file);
// read all data into memory
......
......@@ -508,7 +508,7 @@ void ObservingList::slotNewSelection() {
ui->NotesEdit->setEnabled( false );
ui->SearchImage->setEnabled( false );
}
QString BasePath= QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/'); // FIXME '/' may cause problems on Windows
QString BasePath= QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator();
QString ImagePath;
if( QFile( ImagePath = BasePath + CurrentImage ).exists() ) {
;
......@@ -807,7 +807,7 @@ void ObservingList::slotSaveSessionAs(bool nativeSave) {
void ObservingList::slotSaveList() {
QFile f;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "wishlist.obslist" ) ;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "wishlist.obslist" ) ;
if ( ! f.open( QIODevice::WriteOnly ) ) {
qDebug() << "Cannot write list to file"; // TODO: This should be presented as a message box to the user
return;
......@@ -836,7 +836,7 @@ void ObservingList::slotSaveList() {
void ObservingList::slotLoadWishList() {
QFile f;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "wishlist.obslist" ) ;
f.setFileName( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "wishlist.obslist" ) ;
if ( ! f.open( QIODevice::ReadOnly) ) {
qDebug() << "No WishList Saved yet";
return;
......@@ -1093,7 +1093,7 @@ void ObservingList::slotCustomDSS() {
QString version = QInputDialog::getItem(this, i18n("Customized DSS Download"), i18n("Specify version: "), strList, 0, false, &ok );
QUrl srcUrl( KSDssDownloader::getDSSURL( currentObject()->ra0(), currentObject()->dec0(), width, height, "gif", version, &md ) );
QString CurrentImagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + CurrentImage;
QString CurrentImagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage;
delete m_dl;
m_dl = new KSDssDownloader();
......@@ -1108,13 +1108,13 @@ void ObservingList::slotGetImage( bool _dss, const SkyObject *o ) {
o = currentObject();
ui->SearchImage->setEnabled( false );
ui->ImagePreview->clearPreview();
if( ! QFile::exists( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage ) ) // FIXME: Might have issues on Windows with using '/'
if( ! QFile::exists( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage ) )
setCurrentImage( o );
QFile::remove( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage ) ;
QUrl url;
dss = true;
qDebug() << "FIXME: Removed support for SDSS. Until reintroduction, we will supply a DSS image";
KSDssDownloader *dler = new KSDssDownloader( o, QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + CurrentImage );
KSDssDownloader *dler = new KSDssDownloader( o, QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage );
connect( dler, SIGNAL( downloadComplete( bool ) ), SLOT( downloadReady( bool ) ) );
}
......@@ -1130,10 +1130,10 @@ void ObservingList::downloadReady( bool success ) {
else {
/*
if( QFile( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + CurrentImage ).size() > 13000)
if( QFile( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage ).size() > 13000)
//The default image is around 8689 bytes
*/
CurrentImagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + CurrentImage;
CurrentImagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + CurrentImage;
ui->ImagePreview->showPreview( QUrl::fromLocalFile( CurrentImagePath ) );
saveThumbImage();
ui->ImagePreview->show();
......@@ -1226,7 +1226,7 @@ void ObservingList::slotDeleteAllImages() {
ui->TableView->clearSelection();
ui->SessionView->clearSelection();
ui->ImagePreview->clearPreview();
QDirIterator iterator( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "" ) ;
QDirIterator iterator( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + "" ) ;
while( iterator.hasNext() )
{
// TODO: Probably, there should be a different directory for cached images in the observing list.
......@@ -1318,10 +1318,10 @@ void ObservingList::slotDeleteCurrentImage() {
}
void ObservingList::saveThumbImage() {
if( ! QFile::exists( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + ThumbImage ) ) {
if( ! QFile::exists( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + ThumbImage ) ) {
QImage img( CurrentImagePath );
img = img.scaled( 200, 200, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
img.save( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + ThumbImage ) ;
img.save( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + ThumbImage ) ;
}
}
......
......@@ -908,7 +908,7 @@ void ScriptBuilder::slotRunScript() {
//is not executable. Bizarre...
//KTempFile tmpfile;
//QString fname = tmpfile.name();
QString fname = QDir::tempPath() + QLatin1Char('/') + "kstars-tempscript";
QString fname = QDir::tempPath() + QDir::separator() + "kstars-tempscript";
QFile f( fname );
if ( f.exists() ) f.remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment