ManualImportWindow.cpp   ManualImportWindow.cpp 
skipping to change at line 34 skipping to change at line 34
#include "ui_manualImportWindow.h" #include "ui_manualImportWindow.h"
#include <QColor> #include <QColor>
#include <QColorDialog> #include <QColorDialog>
#include <QFileDialog> #include <QFileDialog>
#include <QImageReader> #include <QImageReader>
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelUtils.hpp"
//#include "StelTranslator.hpp" //#include "StelTranslator.hpp"
ManualImportWindow::ManualImportWindow() ManualImportWindow::ManualImportWindow()
{ {
ui = new Ui_manualImportWindow(); ui = new Ui_manualImportWindow();
ssoManager = GETSTELMODULE(SolarSystemEditor); ssoManager = GETSTELMODULE(SolarSystemEditor);
} }
ManualImportWindow::~ManualImportWindow() ManualImportWindow::~ManualImportWindow()
{ {
skipping to change at line 168 skipping to change at line 167
} }
void ManualImportWindow::selectTextureFile(QLineEdit * filePathLineEdit) void ManualImportWindow::selectTextureFile(QLineEdit * filePathLineEdit)
{ {
//Find out the parent directory of the last selected file. //Find out the parent directory of the last selected file.
//Open the textures directory if no file have been selected. //Open the textures directory if no file have been selected.
QString texturesDirectoryPath; QString texturesDirectoryPath;
QString currentFileName = filePathLineEdit->text(); QString currentFileName = filePathLineEdit->text();
if (currentFileName.isEmpty()) if (currentFileName.isEmpty())
{ {
try texturesDirectoryPath = StelFileMgr::findFile("textures", St
{ elFileMgr::Directory);
texturesDirectoryPath = StelFileMgr::findFile("textu if (texturesDirectoryPath.isEmpty())
res", StelFileMgr::Directory);
}
catch (std::runtime_error &e)
{
qDebug() << e.what();
return; return;
}
} }
else else
{ {
QString currentFilePath; QString currentFilePath = StelFileMgr::findFile("textures/"
try + currentFileName, StelFileMgr::File);
{
currentFilePath = StelFileMgr::findFile("textures/"
+ currentFileName, StelFileMgr::File);
}
catch (std::runtime_error &e)
{
qDebug() << e.what();
filePathLineEdit->clear();
return;
}
if (currentFilePath.isEmpty()) if (currentFilePath.isEmpty())
currentFileName, StelFileMgr::File);
{ {
filePathLineEdit->clear(); filePathLineEdit->clear();
return; return;
} }
QFileInfo currentFileInfo(currentFilePath); QFileInfo currentFileInfo(currentFilePath);
texturesDirectoryPath = currentFileInfo.canonicalPath(); texturesDirectoryPath = currentFileInfo.canonicalPath();
} }
//Select an existing file //Select an existing file
skipping to change at line 238 skipping to change at line 221
QPixmap texture(filePath); QPixmap texture(filePath);
if (texture.isNull()) if (texture.isNull())
{ {
qDebug() << "File doesn't exist or is not an accepted texure format:" qDebug() << "File doesn't exist or is not an accepted texure format:"
<< filePath; << filePath;
return false; return false;
} }
if (!StelUtils::isPowerOfTwo(texture.height())) if (!verifyPowerOfTwo(texture.height()))
{ {
qDebug() << "Invalid texure height:" << texture.height() qDebug() << "Invalid texure height:" << texture.height()
<< "for file" << filePath; << "for file" << filePath;
return false; return false;
} }
if (!StelUtils::isPowerOfTwo(texture.width())) if (!verifyPowerOfTwo(texture.width()))
{ {
qDebug() << "Invalid texture width:" << texture.width() qDebug() << "Invalid texture width:" << texture.width()
<< "for file" << filePath; << "for file" << filePath;
return false; return false;
} }
return true; return true;
} }
bool ManualImportWindow::verifyPowerOfTwo(int value)
{
if (value > 0 && (value & (value-1)) == 0)
return true;
else
return false;
}
 End of changes. 8 change blocks. 
24 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/