Commit 0ea3cdf0 authored by Mike Kremer's avatar Mike Kremer

Changed DATA_NONE to DATA_UNKNOWN. Replaced all occurrences of it. If a data...

Changed DATA_NONE to DATA_UNKNOWN. Replaced all occurrences of it. If a data type is not found, typeId() now returns DATA_UNKNOWN instead of -1 which formerly returned UINT max since it was casted to an unsigned int.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7306 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b748b9bd
......@@ -865,7 +865,7 @@ Core::slotRecentOpen(QAction* _action)
QVector< OpenFlipper::Options::RecentFile > recentFiles = OpenFlipper::Options::recentFiles();
for (int i = 0 ; i < recentFiles.size() ; ++i )
if ( recentFiles[i].filename == _action->text() ){
if (recentFiles[i].type == DATA_NONE)
if (recentFiles[i].type == DATA_UNKNOWN)
loadSettings( recentFiles[i].filename );
else{
OpenFlipper::Options::loadingRecentFile(true);
......
......@@ -163,7 +163,7 @@ void Core::preprocessObjFile(QString _filename)
// find out data type
DataType dataType = DATA_NONE;
DataType dataType = DATA_UNKNOWN;
std::string fname = _filename.toStdString();
std::fstream in(fname.c_str(), std::ios_base::in);
......
......@@ -167,7 +167,7 @@ int Core::loadObject ( QString _filename ) {
openIniFile(_filename,true,true,true);
if ( OpenFlipper::Options::gui() )
coreWidget_->addRecent(_filename, DATA_NONE);
coreWidget_->addRecent(_filename, DATA_UNKNOWN);
return -2;
} else
......@@ -183,7 +183,7 @@ int Core::loadObject ( QString _filename ) {
/// Function for loading a given file
int Core::loadObject( DataType _type, QString _filename) {
if (_type == DATA_NONE)
if (_type == DATA_UNKNOWN)
return loadObject(_filename);
for (int i=0; i < (int)supportedTypes_.size(); i++)
......@@ -596,7 +596,7 @@ void Core::loadSettings(){
applyOptions();
}
coreWidget_->addRecent(complete_name, DATA_NONE);
coreWidget_->addRecent(complete_name, DATA_UNKNOWN);
}
}
......
......@@ -251,6 +251,6 @@ void Core::saveSettings(){
//add to recent files
if ( OpenFlipper::Options::gui() )
coreWidget_->addRecent( complete_name, DATA_NONE );
coreWidget_->addRecent( complete_name, DATA_UNKNOWN );
}
......@@ -83,7 +83,7 @@ BaseObject::BaseObject(const BaseObject& _object) {
BaseObject::BaseObject(BaseObject* _parent) :
id_(-1),
persistentId_(-1),
objectType_(DATA_NONE),
objectType_(DATA_UNKNOWN),
flags_(),
visible_(true),
parentItem_(_parent),
......@@ -123,7 +123,7 @@ void BaseObject::persistentId( int _id ) {
void BaseObject::cleanup() {
persistentId_ = -1;
objectType_ = DATA_NONE;
objectType_ = DATA_UNKNOWN;
flags_.clear();
......@@ -148,7 +148,7 @@ DataType BaseObject::dataType() {
}
void BaseObject::setDataType(DataType _type) {
if ( objectType_ != DATA_NONE )
if ( objectType_ != DATA_UNKNOWN )
std::cerr << "BaseObect : overwriting data type" << std::endl;
objectType_ = _type;
}
......
......@@ -117,8 +117,8 @@ static std::vector< TypeInfo > types;
void initialize() {
if ( !initialized_ ) {
stringToTypeInfo["Unknown"] = types.size();
typeToTypeInfo[DATA_NONE] = types.size();
types.push_back( TypeInfo(DATA_NONE ,"Unknown" ,"Unknown.png", QCoreApplication::translate("Types","Unknown")) );
typeToTypeInfo[DATA_UNKNOWN] = types.size();
types.push_back( TypeInfo(DATA_UNKNOWN ,"Unknown" ,"Unknown.png", QCoreApplication::translate("Types","Unknown")) );
stringToTypeInfo["Group"] = types.size();
typeToTypeInfo[DATA_GROUP] = types.size();
......@@ -136,7 +136,7 @@ void initialize() {
typeToTypeInfo[DATA_ALL] = types.size();
types.push_back( TypeInfo(DATA_ALL ,"All" ,"Unknown.png", QCoreApplication::translate("Types","All")) );
typeToString[DATA_NONE] = "Unknown";
typeToString[DATA_UNKNOWN] = "Unknown";
typeToString[DATA_GROUP] = "Group";
typeToString[DATA_TRIANGLE_MESH_CONST_ID] = "TriangleMesh";
typeToString[DATA_POLY_MESH_CONST_ID] = "PolyMesh";
......@@ -174,7 +174,7 @@ DataType typeId(QString _name) {
#ifdef DEBUG
std::cerr << "Unknown Data type with name " << _name.toStdString() << std::endl;
#endif
return -1;
return DATA_UNKNOWN;
}
}
......@@ -283,7 +283,6 @@ void setDataTypeName( DataType _id , QString _name ) {
types[ index->second ].readableName = _name;
else
std::cerr << "Could not set human name for DataType. Type not found!" << std::endl;
}
/// Set the icon for a given dataType
......@@ -296,8 +295,6 @@ void setDataTypeName( QString _typeName , QString _name ) {
types[ index->second ].readableName = _name;
else
std::cerr << "Could not set human name for DataType. Type not found!" << std::endl;
}
//=============================================================================
......
......@@ -68,11 +68,11 @@
/** \brief Predefined datatypes
*
* Here are several datatypes which have predefined ids. This might be changed to runtime added
* datatypes in the futere.
* datatypes in the future.
*/
/// None of the other Objects
#define DATA_NONE 0
#define DATA_UNKNOWN 0
/// Items used for Grouping
#define DATA_GROUP 1
......
......@@ -79,6 +79,6 @@ void addEmptyWidget::slotAddEmpty(){
this->close();
return;
}
emit chosen(DATA_NONE,unused);
emit chosen(DATA_UNKNOWN,unused);
this->close();
}
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