~ubuntu-branches/debian/sid/stellarium/sid

« back to all changes in this revision

Viewing changes to src/core/modules/ConstellationMgr.cpp

  • Committer: Package Import Robot
  • Author(s): Tomasz Buchert
  • Date: 2013-08-04 15:06:55 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130804150655-iji0vb5navh3lk13
Tags: 0.12.2-1
* Imported Upstream version 0.12.2
* Added dependency to phonon (to enable video/sound)
* Fixed VCS links
* Removed unused lintian tag (embedded-library glee)
* Dropped obsolete patch
* Update copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <QRegExp>
27
27
#include <QString>
28
28
#include <QStringList>
 
29
#include <QDir>
29
30
 
30
31
#include "ConstellationMgr.hpp"
31
32
#include "Constellation.hpp"
128
129
        }
129
130
        catch (std::runtime_error& e)
130
131
        {
131
 
                qDebug() << "No constellationsart.fab file found for sky culture " << skyCultureDir;
 
132
                qDebug() << "No constellationsart.fab file found for sky culture " << QDir::toNativeSeparators(skyCultureDir);
132
133
        }
133
134
 
134
135
        try
147
148
        catch (std::runtime_error& e)
148
149
        {
149
150
                qWarning() << "ERROR: while loading new constellation data for sky culture "
150
 
                        << skyCultureDir << ", reason: " << e.what() << endl;
 
151
                        << QDir::toNativeSeparators(skyCultureDir) << ", reason: " << e.what() << endl;
151
152
        }
152
153
 
153
154
        // TODO: do we need to have an else { clearBoundaries(); } ?
302
303
        QFile in(fileName);
303
304
        if (!in.open(QIODevice::ReadOnly | QIODevice::Text))
304
305
        {
305
 
                qWarning() << "Can't open constellation data file" << fileName  << "for culture" << cultureName;
 
306
                qWarning() << "Can't open constellation data file" << QDir::toNativeSeparators(fileName)  << "for culture" << cultureName;
306
307
                Q_ASSERT(0);
307
308
        }
308
309
 
367
368
        QFile fic(artfileName);
368
369
        if (!fic.open(QIODevice::ReadOnly | QIODevice::Text))
369
370
        {
370
 
                qWarning() << "Can't open constellation art file" << fileName  << "for culture" << cultureName;
 
371
                qWarning() << "Can't open constellation art file" << QDir::toNativeSeparators(fileName)  << "for culture" << cultureName;
371
372
                return;
372
373
        }
373
374
 
435
436
                        {
436
437
                                // if the texture isn't found in the skycultures/[culture] directory,
437
438
                                // try the central textures diectory.
438
 
                                qWarning() << "WARNING, could not locate texture file " << texfile
 
439
                                qWarning() << "WARNING, could not locate texture file " << QDir::toNativeSeparators(texfile)
439
440
                                         << " in the skycultures/" << cultureName
440
441
                                         << " directory...  looking in general textures/ directory...";
441
442
                                try
444
445
                                }
445
446
                                catch(std::exception& e2)
446
447
                                {
447
 
                                        qWarning() << "ERROR: could not find texture, " << texfile << ": " << e2.what();
 
448
                                        qWarning() << "ERROR: could not find texture, " << QDir::toNativeSeparators(texfile) << ": " << e2.what();
448
449
                                }
449
450
                        }
450
451
 
616
617
        QFile commonNameFile(namesFile);
617
618
        if (!commonNameFile.open(QIODevice::ReadOnly | QIODevice::Text))
618
619
        {
619
 
                qDebug() << "Cannot open file" << namesFile;
 
620
                qDebug() << "Cannot open file" << QDir::toNativeSeparators(namesFile);
620
621
                return;
621
622
        }
622
623
 
649
650
 
650
651
                if (!recRx.exactMatch(record))
651
652
                {
652
 
                        qWarning() << "ERROR - cannot parse record at line" << lineNumber << "in constellation names file" << namesFile;
 
653
                        qWarning() << "ERROR - cannot parse record at line" << lineNumber << "in constellation names file" << QDir::toNativeSeparators(namesFile);
653
654
                }
654
655
                else
655
656
                {
696
697
void ConstellationMgr::setArtIntensity(const double intensity)
697
698
{
698
699
        if (artIntensity != intensity)
699
 
        {
700
700
                artIntensity = intensity;
701
 
                vector < Constellation * >::const_iterator iter;
702
 
                for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
703
 
                {
704
 
                        (*iter)->artFader.setMaxValue(artIntensity);
705
 
                }
706
 
                emit artIntensityChanged(intensity);
 
701
 
 
702
        vector < Constellation * >::const_iterator iter;
 
703
        for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
 
704
        {
 
705
                (*iter)->artFader.setMaxValue(artIntensity);
707
706
        }
 
707
        emit artIntensityChanged(intensity);
708
708
}
709
709
 
710
710
double ConstellationMgr::getArtIntensity() const
714
714
 
715
715
void ConstellationMgr::setArtFadeDuration(const float duration)
716
716
{
717
 
        if(artFadeDuration != duration)
718
 
        {
 
717
        if (artFadeDuration != duration)
719
718
                artFadeDuration = duration;
720
 
                vector < Constellation * >::const_iterator iter;
721
 
                for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
722
 
                {
723
 
                        (*iter)->artFader.setDuration((int) (duration * 1000.f));
724
 
                }
725
 
                emit artFadeDurationChanged(duration);
 
719
 
 
720
        vector < Constellation * >::const_iterator iter;
 
721
        for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
 
722
        {
 
723
                (*iter)->artFader.setDuration((int) (duration * 1000.f));
726
724
        }
 
725
        emit artFadeDurationChanged(duration);
727
726
}
728
727
 
729
728
float ConstellationMgr::getArtFadeDuration() const
1029
1028
        QFile dataFile(boundaryFile);
1030
1029
        if (!dataFile.open(QIODevice::ReadOnly | QIODevice::Text))
1031
1030
        {
1032
 
                qWarning() << "Boundary file " << boundaryFile << " not found";
 
1031
                qWarning() << "Boundary file " << QDir::toNativeSeparators(boundaryFile) << " not found";
1033
1032
                return false;
1034
1033
        }
1035
1034
 
1134
1133
        QStringList result;
1135
1134
        if (maxNbItem==0) return result;
1136
1135
 
1137
 
        QString objw = objPrefix.toUpper();
1138
 
 
 
1136
        QString cn;
1139
1137
        vector < Constellation * >::const_iterator iter;
1140
1138
        for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
1141
1139
        {
1142
 
                QString constw = (*iter)->getNameI18n().mid(0, objw.size()).toUpper();
1143
 
                if (constw==objw)
 
1140
                cn = (*iter)->getNameI18n();
 
1141
                if (cn.contains(objPrefix,Qt::CaseInsensitive))
1144
1142
                {
1145
 
                        result << (*iter)->getNameI18n();
 
1143
                        result << cn;
1146
1144
                        if (result.size()==maxNbItem)
1147
1145
                                return result;
1148
1146
                }
1155
1153
        QStringList result;
1156
1154
        if (maxNbItem==0) return result;
1157
1155
 
1158
 
        QString objw = objPrefix.toUpper();
1159
 
 
 
1156
        QString cn;
1160
1157
        vector < Constellation * >::const_iterator iter;
1161
1158
        for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
1162
1159
        {
1163
 
                QString constw = (*iter)->getEnglishName().mid(0, objw.size()).toUpper();
1164
 
                if (constw==objw)
 
1160
                cn = (*iter)->getEnglishName();
 
1161
                if (cn.contains(objPrefix, Qt::CaseInsensitive))
1165
1162
                {
1166
 
                        result << (*iter)->getEnglishName();
 
1163
                        result << cn;
1167
1164
                        if (result.size()==maxNbItem)
1168
1165
                                return result;
1169
1166
                }