Exemplo n.º 1
0
QString Options::qtBin( const QString& fileName )
{
	QString filePath;
	if ( fileName.isEmpty() )
		return QString::null;
	else
	{
		filePath = self()->value( "Options/General/QtPath" ).toString().append( "/bin/" ).append( fileName );
#if defined( Q_OS_MAC )
		//some tools, such as "lupdate" are normal files
		//others, such as "assistant" are osx application directories
		if ( !QFile::exists( filePath ) )
		{
			filePath.append( ".app" );
			QDir appDir( filePath );
			if ( appDir.exists() )       
				filePath.append( "/Contents/MacOS/" ).append( fileName );
		}
#endif
		if ( !QFile::exists( filePath ) )
			filePath = fileName;
	}
	return Tools::quoted( filePath );
/*
	if ( !self()->value( "Options/Path/qtPath" ).toString().isEmpty() )
		return Tools::quoted( QString( "%1/bin/%2" ).arg( self()->value( "Options/Path/qtPath" ).toString(), fileName ) );
	return Tools::quoted( fileName );
*/
}
Exemplo n.º 2
0
UfrawWorker::UfrawWorker()
    : WorkerBase("ufraw")
{
    QDir appDir(QCoreApplication::applicationDirPath());
    m_ufrawPath  = appDir.filePath("ufraw-batch");
    m_enfusePath = appDir.filePath("enfuse");
}
Exemplo n.º 3
0
const QList< QDir >
PluginLoader::pluginDirs()
{
    QList< QDir > pluginDirs;

    QDir appDir( QCoreApplication::instance()->applicationDirPath() );
#ifdef Q_WS_MAC
    if ( appDir.dirName() == "MacOS" )
    {
        // Development convenience-hack
        appDir.cdUp();
        appDir.cdUp();
        appDir.cdUp();
    }
#endif

    QDir installLibDir( CMAKE_INSTALL_PREFIX "/lib" );

    QDir libDir( appDir );
    libDir.cdUp();
    libDir.cd( "lib" );

    QDir lib64Dir( appDir );
    lib64Dir.cdUp();
    lib64Dir.cd( "lib64" );

    pluginDirs << appDir << installLibDir << libDir << lib64Dir;
    return pluginDirs;
}
Exemplo n.º 4
0
void AccountManager::LoadAccounts()
{
	QDir appDir(QCoreApplication::applicationDirPath());
	if(appDir.exists("accounts.dat"))
	{
		QFile accountsFile(appDir.absoluteFilePath("accounts.dat"));
		if(accountsFile.open(QIODevice::ReadOnly))
		{
			QDataStream in(&accountsFile);
			in.setVersion(QDataStream::Qt_4_3);
			int version;
			in >> version;
			while(!in.atEnd())
			{
				Account * a = new Account(in, version);
				if(in.status() == QDataStream::Ok)
				{
					listOfAccounts.append(a);
					listOfAccountsByName.insert(a->GetLogin(), a);
				}
				else
				{
					LogError("Bad account file, stop parsing");
					delete a;
					break;
				}
			}
		}
Exemplo n.º 5
0
    Application::Application(int argc, char *argv[])
        : QObject(0)
    {
#ifndef _WIN32
#ifdef __APPLE__
        QDir dir(argv[0]);
        assert(dir.cdUp());
        assert(dir.cdUp());
        assert(dir.cd("plugins"));
        QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#else
        std::string appDir(argv[0]);
        appDir = appDir.substr(0, appDir.rfind("/") + 1);
        appDir += "plugins";
        QCoreApplication::setLibraryPaths(QStringList(QString::fromStdString(appDir)));
#endif //__APPLE__
#endif //_WIN32

        app_.reset(new QApplication(argc, argv));

        peer_.reset(new LocalPeer(0, !isMainInstance()));
        if (isMainInstance())
        {
            peer_->listen();
        }

        QObject::connect(&Utils::InterConnector::instance(), SIGNAL(schemeUrlClicked(QString)), this, SLOT(receiveUrlCommand(QString)), Qt::DirectConnection);
        QObject::connect(app_.get(), &QGuiApplication::applicationStateChanged, this, &Application::applicationStateChanged, Qt::DirectConnection);
    }
void
MiamiAllAccessBasketball::checkAppDirectory() {
    QDir appDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
    if (!appDir.exists()) {
        appDir.mkdir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
    }
}
Exemplo n.º 7
0
/**
 * Return the path where dot is installed.
 *
 * @return string with dot path
 */
QString LayoutGenerator::currentDotPath()
{
#if QT_VERSION >= 0x050000
    QString executable = QStandardPaths::findExecutable(QLatin1String("dot"));
#else
    QString executable = KStandardDirs::findExe(QLatin1String("dot"));
#endif
    if (!executable.isEmpty()) {
        QFileInfo fi(executable);
        return fi.absolutePath();
    }
#ifdef Q_OS_WIN
    // search for dot installation
    QString appDir(QLatin1String(qgetenv("ProgramFiles").constData()));
    QDir dir(appDir);
    dir.setFilter(QDir::Dirs);
    dir.setNameFilters(QStringList() << QLatin1String("Graphviz*"));
    dir.setSorting(QDir::Reversed);
    QFileInfoList list = dir.entryInfoList();
    if (list.size() > 0) {
        QString dotPath = list.at(0).absoluteFilePath();
        QString exePath = QFile::exists(dotPath + QLatin1String("\\bin")) ? dotPath + QLatin1String("\\bin") : dotPath;
        return QFile::exists(exePath + QLatin1String("\\dot.exe")) ? exePath : QString();
    }
#endif
    return QString();
}
Exemplo n.º 8
0
HstesterServer::HstesterServer(QObject *parent):
	QObject(parent)
{
	testManager = new TestManager(this);
	QDir appDir(QCoreApplication::applicationDirPath());
	QString dataDirPath;
#ifdef Q_OS_LINUX
	appDir.cdUp();
	appDir.cdUp();
	dataDirPath = appDir.absolutePath() + "/var/lib/hstest";
#endif
#ifdef Q_OS_WIN32
	dataDirPath = appDir.absolutePath() + "/data";
#endif
	QDir dataDir(dataDirPath);
	if(!dataDir.exists())
		dataDir.mkpath(dataDirPath);
	testManager->setTestDir(dataDirPath);
	testManager->readTestDbFromFile();
	testManager->readStudentDbFromFile();
	testServer = new TestServer(testManager, this);
	
	if(!testServer->listen(QHostAddress::Any, 1605))
	{
		qDebug() << trUtf8("Unable to start the server: ") << testServer->errorString();
		return;
	}
}
Exemplo n.º 9
0
	QString GeneralView::translationDir()
	{
		QDir appDir(qApp->applicationDirPath());
		appDir.cd("..");
		appDir.cd("share/webmounter");
		return appDir.absolutePath();
	}
Exemplo n.º 10
0
void ApplicationsManager::initPSPDir()
{
    if (m_options.isPSPDirSet())
    {
        QDir appDir(m_options.getPSPDir());
        QFileInfoList dirList;
        dirList = appDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
        for (int i = 0; i < dirList.size(); ++i) 
        {
        		qDebug() << dirList.at(i).fileName();
            if (dirList.at(i).fileName().toLower() == "psp")
            {
                QDir pspDir(dirList.at(i).filePath());
                QFileInfoList pspList;
                pspList = pspDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
                for (int i = 0; i < pspList.size(); ++i) 
                {
                		qDebug() << pspList.at(i).fileName();
                    if (dirList.at(i).fileName().toLower() == "game150")
                    {
                        return;
                    }
                }
                //Applications dir not found, we create it
                if (!pspDir.mkdir("GAME150"))
                {
                    //TODO: exception
                }
            }
            return;
        }
        appDir.mkpath("PSP/GAME150");
    }
}
Exemplo n.º 11
0
AppFrameworkDemoDialog::AppFrameworkDemoDialog(QWidget *parent) :
  QDialog(parent),
  ui(new Ui::AppFrameworkDemoDialog)
{
  ui->setupUi(this);

  connect(this, SIGNAL(accepted()), this, SLOT(configurationSelected()));
  connect(this, SIGNAL(rejected()), this, SLOT(dialogCanceled()));
  connect(ui->appList, SIGNAL(currentRowChanged(int)), this, SLOT(selectionChanged(int)));

  // Get all AppFrameworkDemo_*.provisioning files
  QDir appDir(QApplication::applicationDirPath());
#ifdef CMAKE_INTDIR
  appDir.cdUp();
#endif

  provisioningFiles =
      appDir.entryList(QStringList(QApplication::applicationName() + "_*.provisioning"),
                                   QDir::Files | QDir::Readable, QDir::Name);

  foreach(QString provFile, provisioningFiles)
  {
    int startIndex = provFile.indexOf('_');
    int endIndex = provFile.lastIndexOf('.');
    ui->appList->addItem(provFile.mid(startIndex+1, endIndex-startIndex-1));
  }
Exemplo n.º 12
0
void FvUpdater::finishUpdate(QString pathToFinish)
{
	pathToFinish = pathToFinish.isEmpty() ? QCoreApplication::applicationDirPath() : pathToFinish;
	QDir appDir(pathToFinish);
	appDir.setFilter( QDir::Files | QDir::Dirs );

	QFileInfoList dirEntries = appDir.entryInfoList();
	foreach (QFileInfo fi, dirEntries)
	{
		if ( fi.isDir() )
		{
            QString dirname = fi.fileName();
            if ((dirname==".") || (dirname == ".."))
                continue;
			
			// recursive clean up subdirectory
			finishUpdate(fi.filePath());
		}
		else
		{
			if(fi.suffix()=="oldversion")
				if( !appDir.remove( fi.absoluteFilePath() ) )
					qDebug()<<"Error: Unable to clean up file: "<<fi.absoluteFilePath();

		}
	}	// For each dir entry END
}
Exemplo n.º 13
0
void
EnsureTemplates(void)
{
	// Because creating a new project depends on the existence of the Templates folder,
	// make sure that we have some (very) basic templates to work with if the folder
	// has been deleted.
	DPath templatePath = gAppPath.GetFolder();
	templatePath << "Templates";
	
	bool missing = false;
	BDirectory tempDir;
	if (!BEntry(templatePath.GetFullPath()).Exists())
	{
		BDirectory appDir(gAppPath.GetFolder());
		appDir.CreateDirectory("Templates", &tempDir);
		missing = true;
	}
	else
	{
		tempDir.SetTo(templatePath.GetFullPath());
		if (tempDir.CountEntries() == 0)
			missing = true;
	}
	
	if (missing)
	{
		BDirectory dir;
		tempDir.CreateDirectory("Empty Application", &dir);
		tempDir.CreateDirectory("Kernel Driver", &dir);
		tempDir.CreateDirectory("Shared Library or Addon", &dir);
		tempDir.CreateDirectory("Static Library", &dir);
		
		DPath filePath;
		TextFile file;
		
		filePath = templatePath;
		filePath << "Empty Application/TEMPLATEINFO";
		file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
		file.WriteString("TYPE=Application\nLIB=B_BEOS_LIB_DIRECTORY/libsupc++.so\n");
		
		filePath = templatePath;
		filePath << "Kernel Driver/TEMPLATEINFO";
		file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
		file.WriteString("TYPE=Driver\n");
		
		filePath = templatePath;
		filePath << "Shared Library or Addon/TEMPLATEINFO";
		file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
		file.WriteString("TYPE=Shared\n");
		
		filePath = templatePath;
		filePath << "Static Library/TEMPLATEINFO";
		file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
		file.WriteString("TYPE=Static\n");
		
		file.Unset();
	}
}
Exemplo n.º 14
0
void ZealDocsetsRegistry::initialiseDocsets()
{
    clear();
    addDocsetsFromFolder(QDir(docsetsDir()));
    QDir appDir( QCoreApplication::applicationDirPath() );
    if(appDir.cd("docsets")){
        addDocsetsFromFolder(appDir);
    }
}
Exemplo n.º 15
0
/**
* Load a OMOptim plugin
* \param pluginPath full file path of .dll
* \param storePath yes/no should path be stored in project file
* (as to be reloaded when loading project)
* \param forceLoad yes/no should mo file be reloaded in OMC when already loaded in OMC
*/
bool ProjectBase::loadPlugin(QString pluginPath, bool storePath, bool forceLoad)
{
    InfoSender::instance()->sendNormal("Loading plugin : "+pluginPath);

    bool tryLoad;

    tryLoad = (forceLoad || !_pluginsLoaded.values().contains(pluginPath));

    if(!tryLoad)
        return false;

    // unload if needed
    QFileInfo pluginFile(pluginPath);
    QDir appDir(QApplication::applicationDirPath());
    QString destPluginPath = appDir.absoluteFilePath(pluginFile.fileName());

    if(forceLoad && _pluginsLoaded.values().contains(pluginPath))
        unloadPlugin(destPluginPath);

    // copy plugin in application folder since it requires libraries
    if(pluginPath!=destPluginPath)
        appDir.remove(pluginFile.fileName());
    QFile::copy(pluginPath,destPluginPath);


    // first try to load
    QPluginLoader loader(destPluginPath);
    QObject *plugin = loader.instance();
    ProblemInterface* pbInter = qobject_cast<ProblemInterface*>(plugin);

    if(pbInter)
    {
        InfoSender::instance()->sendNormal("Loaded plugin successfully : "+pbInter->name());
        this->addProblemInterface(pbInter);

        // added corresponding settings
        MOParameters* pluginParams = pbInter->parameters();
        MOSettings::addParameters(pluginParams,pbInter->name());
    }
    else
    {
        InfoSender::instance()->sendError("Loaded plugin failed : "+pluginPath
                                          +"\n("+loader.errorString()+")");
    }

    bool loadOk = (pbInter!=NULL);

    // add to stored list
    if(loadOk && storePath)
    {
        _pluginsLoaded.insert(pbInter->name(),pluginPath);
        emit projectChanged();
    }

    return loadOk;
}
/*!	Constructs a DefaultCatalog with given signature and language and reads
	the catalog from disk.
	InitCheck() will be B_OK if catalog could be loaded successfully, it will
	give an appropriate error-code otherwise.
*/
DefaultCatalog::DefaultCatalog(const entry_ref &catalogOwner, const char *language,
	uint32 fingerprint)
	:
	HashMapCatalog("", language, fingerprint)
{
	// We created the catalog with an invalid signature, but we fix that now.
	SetSignature(catalogOwner);
	status_t status;

	// search for catalog living in sub-folder of app's folder:
	node_ref nref;
	nref.device = catalogOwner.device;
	nref.node = catalogOwner.directory;
	BDirectory appDir(&nref);
	BString catalogName("locale/");
	catalogName << kCatFolder
		<< "/" << fSignature
		<< "/" << fLanguageName
		<< kCatExtension;
	BPath catalogPath(&appDir, catalogName.String());
	status = ReadFromFile(catalogPath.Path());

	if (status != B_OK) {
		// search in data folders

		directory_which which[] = {
			B_USER_DATA_DIRECTORY,
			B_COMMON_DATA_DIRECTORY,
			B_SYSTEM_DATA_DIRECTORY
		};

		for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) {
			BPath path;
			if (find_directory(which[i], &path) == B_OK) {
				BString catalogName(path.Path());
				catalogName << "/locale/" << kCatFolder
					<< "/" << fSignature
					<< "/" << fLanguageName
					<< kCatExtension;
				status = ReadFromFile(catalogName.String());
				if (status == B_OK)
					break;
			}
		}
	}

	if (status != B_OK) {
		// give lowest priority to catalog embedded as resource in application
		// executable, so they can be overridden easily.
		status = ReadFromResource(catalogOwner);
	}

	fInitCheck = status;
}
Exemplo n.º 17
0
/*! \fn bool UcDbSettings::restoreDefaultDatabase()
 * Writes the clean database file to application specifc folder created at time of initial installation.
 * \return If file copy operation was successful
 * \warning  Method Should not depend on anything else.
 * \warning Not used in application due to Write Access depending on OS, file system or folder location.
 * \sa bool UcDbSettings::establishDatabase()
 */
bool UcDbSettings::restoreDefaultDatabase(){
    QFile resourceDb(":/db/sprinted.db");
    QDir appDir(QDir::home().filePath("sprintedapp"));
    QFile settingsTxt(appDir.filePath("usersettings.txt"));
    if(settingsTxt.exists()){
      settingsTxt.remove();
    }
    bool val = resourceDb.copy(appDir.filePath("sprinted.db"));
    if(val)
        resourceDb.setPermissions(QFile::WriteUser);
    return val;
}
Exemplo n.º 18
0
void K3bIsoImager::clearDummyDirs()
{
  QString jobId = qApp->sessionId() + "_" + QString::number( m_sessionNumber );
  QDir appDir( locateLocal( "appdata", "temp/" ) );
  if( appDir.cd( jobId ) ) {
    QStringList dummyDirEntries = appDir.entryList( "dummydir*", QDir::Dirs );
    for( QStringList::iterator it = dummyDirEntries.begin(); it != dummyDirEntries.end(); ++it )
      appDir.rmdir( *it );
    appDir.cdUp();
    appDir.rmdir( jobId );
  }
}
Exemplo n.º 19
0
/**
 * \return True if the application is deployed and all resources are inside the App bundle.
 * This always returns true if the OS is not a Mac OS.
 */
bool RSettings::isDeployed() {
#ifdef Q_OS_MAC
    QDir appDir(QApplication::applicationDirPath());
    if (appDir.dirName() == "MacOS") {
        appDir.cdUp();
        // deployed (scripts inside app bundle):
        return appDir.cd("Resources/scripts");
    }
    return false;
#else
    return true;
#endif
}
Exemplo n.º 20
0
AutoSaveFile* AutoSaveFile::getFile(const QString &filename)
{
    AutoSaveFile* result = 0;
    QDir appDir(path());
    QFileInfo info(appDir.absolutePath(), hashName(filename) + extension);

    if (info.exists()) {
        result = new AutoSaveFile(filename);
        result->setFileName(info.filePath());
        result->m_managedFileNameChanged = false;
    }

    return result;
}
Exemplo n.º 21
0
void adjust_path()
{
    char *new_path;
    char *binDir;

    if (is_nmt100()) {
        binDir="nmt100";
    } else {
        binDir="nmt200";
    }

    ovs_asprintf(&new_path,"%s:%s/bin/%s",getenv("PATH"),appDir(),binDir);
    setenv("PATH",new_path,1);
}
Exemplo n.º 22
0
void AppPathManager::install()
{
#if defined(__ANDROID__) || defined(__APPLE__)
    QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
#else
    QString path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
#endif
    if(!path.isEmpty())
    {
        QDir appDir(path+UserDirName);
        if(!appDir.exists())
            appDir.mkpath(path+UserDirName);
    }
}
Exemplo n.º 23
0
char *get_mount_command(NETFSProtocol proto,char *link,char *path,char *user,char *passwd) {

   char *cmd = NULL;
   char *log;
   char *host = strstr(link,"://");

   ovs_asprintf(&log,"%s/logs/mnterr.log",appDir());
   if (host) {

       host +=3;

       if (proto == PROTO_NFS_TCP || proto == PROTO_NFS ) {

            char *host_end = strpbrk(host,":/");
            char *remote_path_start = strchr(host,'/');
            char *opt="";
            if (proto == PROTO_NFS_TCP) {
                opt=",proto=tcp";
            }

            // iplink = nfs://host:/share
            // mount -t -o soft,nolock,timeo=10 host:/share /path/to/network
            ovs_asprintf(&cmd,
                "mkdir -p \"%s\" 2> \"%s\" && mount -o soft,nolock,timeo=10%s \"%.*s:%s\" \"%s\" 2>> \"%s\"",
                path,log,opt,host_end-host,host,remote_path_start,path,log);

        } else if (proto == PROTO_SMB) {

            // link = smb://host/share
            // mount -t cifs -o username=,password= //host/share /path/to/network

            if (EMPTY_STR(user)) {
                user = "******";
            }

            ovs_asprintf(&cmd,"mkdir -p \"%s\" 2> \"%s\" && mount -t cifs -o \"nomand,noatime,nodiratime,username=%s,password=%s\" \"//%s\" \"%s\" 2> \"%s\"",
                    path,log,
                    user,
                    NVL(passwd),
                    host,path,log);
        } else {
            html_log(0,"Dont know how to mount [%s]",link);
        }
    } else {
        html_log(0,"Dont know how to mount host [%s]",link);
    }
    FREE(log);
    return cmd;
}
Exemplo n.º 24
0
/*! \fn bool UcDbSettings::establishDatabase()
 * Writes the clean database file to a folder in User's Home Folder. This method should not depend on anything else.
 * \return If folder creation and file copy operations were successful
 * \warning Method Should not depend on anything else except for bool UcDbSettings::restoreDefaultDatabase().
 * \warning Not used in application due to Write Access depending on OS, file system or folder location.
 * \sa bool UcDbSettings::restoreDefaultDatabase()
 */
bool UcDbSettings::establishDatabase(){
    bool returnVal = false;
    QDir appDir(QDir::home().filePath("sprintedapp"));
    QFile dbFile(appDir.filePath("sprinted.db"));
    QFile settingsTxt(appDir.filePath("usersettings.txt"));
    if(dbFile.exists() || settingsTxt.exists()){
        returnVal =  true;
    }else if(appDir.exists()){
         return returnVal = restoreDefaultDatabase();
    }else{
        QDir::home().mkdir("sprintedapp");
        return returnVal = restoreDefaultDatabase();
    }
    return returnVal;
}
Exemplo n.º 25
0
Arquivo: SApp.cpp Projeto: 3rdexp/soui
SApplication::SApplication(IRenderFactory *pRendFactory,HINSTANCE hInst,LPCTSTR pszHostClassName)
    :m_hInst(hInst)
    ,m_RenderFactory(pRendFactory)
{
    SWndSurface::Init();
    _CreateSingletons();
    CSimpleWndHelper::Init(m_hInst,pszHostClassName);
    STextServiceHelper::Init();
    SRicheditMenuDef::Init();
    m_translator.Attach(new SNullTranslator);
    m_tooltipFactory.Attach(new SDefToolTipFactory);
    
    SAppDir appDir(hInst);
    m_strAppDir = appDir.AppDir();
}
Exemplo n.º 26
0
void init() {
    QStringList paths = QCoreApplication::libraryPaths();
    paths.append(".");
    paths.append("platforms");
    QCoreApplication::setLibraryPaths(paths);

    QDir appDir(APPDIR);
    if (!appDir.exists()) appDir.mkdir(APPDIR);

    QFile serials(APPDIR + "serials.dat");
    serials.open(QIODevice::ReadWrite);
    serials.close();

    serialList.load(APPDIR + "serials.dat");
}
Exemplo n.º 27
0
void	
TheApp::ReadyToRun()
{
	app_info theInfo;

	fMainWin = new MainWindow();

	if (be_app->GetAppInfo(&theInfo) == B_OK) {
		BPath appDir(&theInfo.ref);
		appDir.GetParent(&appDir);

		// Emoticons settings
		BPath currentPath = appDir;
		currentPath.Append("smileys");
		currentPath.Append("settings.xml");

		// Load emoticons
		BEntry entry(currentPath.Path());
		if (entry.Exists())
			Emoticor::Get()->LoadConfig(currentPath.Path());
		else {
			BString msg("Can't find smileys settings in:\n\n");
			msg << currentPath.Path();
			BAlert* alert = new BAlert("", msg.String(), "Ouch!");
			alert->Go();
		}
		printf("Loaded Emoticons settings from: %s\n", currentPath.Path());

		currentPath = appDir;
		currentPath.Append("protocols");
		if (BEntry(currentPath.Path()).Exists()) {
			printf("Looking for protocols from: %s\n", currentPath.Path());

			ProtocolManager::Get()->Init(BDirectory(currentPath.Path()),
				fMainWin);
		} else {
			BString msg("Can't find protocols in:\n\n");
			msg << currentPath.Path();
			BAlert* alert = new BAlert("", msg.String(), "Ouch!");
			alert->Go();
			PostMessage(B_QUIT_REQUESTED);
			return;
		}
	}

	fMainWin->Start();
	fMainWin->Show();
}
Exemplo n.º 28
0
void Resource::setPaths(Resource::SettingsIDs id, const QStringList& dirList)
{
  QStringList listDir;
  QDir appDir(QApplication::applicationDirPath());
  foreach(QString strDir, dirList)
  {
    QDir dir(appDir.relativeFilePath(strDir));
    if (dir.path().isEmpty())
    {
      listDir.append(".");
    }
    else
    {
      listDir.append(QDir::fromNativeSeparators(dir.path()));
    }
  }
Exemplo n.º 29
0
QString dataDirPath()
{
    QString appDirPath("%1/%2");
    appDirPath = appDirPath.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation),
                                qApp->applicationName());
    QDir appDir(appDirPath);
    if (!appDir.exists())
        appDir.mkpath(appDirPath);

#ifdef Q_OS_MAC
    if (!appDir.exists("settings.ini"))
        QProcess::startDetached("sh", QStringList() << "-c" << "cp '" + qApp->applicationDirPath() + "/settings.ini' '" + appDirPath + "/settings.ini'");
#endif

    return appDirPath;
}
Exemplo n.º 30
0
QString MainWindow::dbFilePath()
{
    QDir appDir(QCoreApplication::applicationDirPath());
    // Use app dir if on C: or D: drive
    //if (!appDir.absolutePath().left(2).compare("c:", Qt::CaseInsensitive)
    //        || !appDir.absolutePath().left(2).compare("d:", Qt::CaseInsensitive))
    //{
        m_dbPath = appDir.absoluteFilePath(SQLITE_DB_BASENAME);
    //}
    //else
    //{
    //    QDir defaultDir(SQLITE_DB_DEFAULTDIR);
    //    if (!defaultDir.exists()) defaultDir.mkpath(defaultDir.absolutePath());
    //    m_dbPath = defaultDir.absoluteFilePath(SQLITE_DB_BASENAME);
    //}
    return m_dbPath;
}