bool QgsDatumTransformDialog::testGridShiftFileAvailability( QTreeWidgetItem* item, int col ) const { if ( !item ) { return false; } QString itemText = item->text( col ); if ( itemText.isEmpty() ) { return false; } char* projLib = getenv( "PROJ_LIB" ); if ( !projLib ) //no information about installation directory { item->setToolTip( col, tr( "The PROJ_LIB enviroment variable not set." ) ); return false; } QStringList itemEqualSplit = itemText.split( "=" ); QString filename; for ( int i = 1; i < itemEqualSplit.size(); ++i ) { if ( i > 1 ) { filename.append( "=" ); } filename.append( itemEqualSplit.at( i ) ); } QDir projDir( projLib ); if ( projDir.exists() ) { //look if filename in directory QStringList fileList = projDir.entryList(); QStringList::const_iterator fileIt = fileList.constBegin(); for ( ; fileIt != fileList.constEnd(); ++fileIt ) { #if defined(Q_OS_WIN) if ( fileIt->compare( filename, Qt::CaseInsensitive ) == 0 ) #else if ( fileIt->compare( filename ) == 0 ) #endif //Q_OS_WIN { return true; } } item->setToolTip( col, tr( "File '%1' not found in directory '%2'" ).arg( filename ).arg( projDir.absolutePath() ) ); return false; //not found in PROJ_LIB directory } item->setToolTip( col, tr( "The directory '%1' set to PROJ_LIB variable doesn't exist" ).arg( projDir.absolutePath() ) ); return false; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QStringList argList = a.arguments(); if (argList.count() <= 0) { return -1; // should at least have command name } SkString input; QStringList::const_iterator iter = argList.begin(); SkString commandName(iter->toAscii().data()); ++iter; // skip the command name for ( ; iter != argList.end(); ++iter) { if (0 == iter->compare("--help") || 0 == iter->compare("-h")) { usage(commandName.c_str()); return -1; } else if (input.isEmpty()) { input = SkString(iter->toAscii().data()); } else { usage(commandName.c_str()); return -1; } } SkDebuggerGUI w; if (!input.isEmpty()) { if (SkStrEndsWith(input.c_str(), ".skp")) { w.openFile(input.c_str()); } else { w.setupDirectoryWidget(input.c_str()); } } w.show(); return a.exec(); }