Beispiel #1
0
QString
ResourceFinder::getResourceSaveDir(QString resourceCat)
{
    // Returns the "user" location

    QString user = getUserResourcePrefix();
    if (user == "") return "";

    if (resourceCat != "") resourceCat = "/" + resourceCat;

    QDir userDir(user);
    if (!userDir.exists()) {
        if (!userDir.mkpath(user)) {
            std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << user << "\"" << std::endl;
            return "";
        }
    }

    if (resourceCat != "") {
        QString save = QString("%1%2").arg(user).arg(resourceCat);
        QDir saveDir(save);
        if (!saveDir.exists()) {
            if (!userDir.mkpath(save)) {
                std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << save << "\"" << std::endl;
                return "";
            }
        }
        return save;
    } else {
        return user;
    }
}
Beispiel #2
0
SpellCheck::SpellCheck() :
    m_hunspell(0),
    m_codec(0),
    m_wordchars("")
{
    // There is a considerable lag involved in loading the Spellcheck dictionaries
    QApplication::setOverrideCursor(Qt::WaitCursor);
    loadDictionaryNames();
    // Create the user dictionary word list directiory if necessary.
    const QString user_directory = userDictionaryDirectory();
    QDir userDir(user_directory);

    if (!userDir.exists()) {
        userDir.mkpath(user_directory);
    }

    // Create the configured file if necessary.
    QFile userFile(currentUserDictionaryFile());

    if (!userFile.exists()) {
        if (userFile.open(QIODevice::WriteOnly)) {
            userFile.close();
        }
    }

    // Load the dictionary the user has selected if one was saved.
    SettingsStore settings;
    setDictionary(settings.dictionary());
    QApplication::restoreOverrideCursor();
}
Beispiel #3
0
void MetadataDialog::accept()
{
	UserDirectory userDir(metadataPath(), userID());
	if(!userDir.updateSignatures()) {
		QMessageBox::warning(this, tr("Erreur"), tr("Impossible de mettre à jour les signatures.\n") +
													userDir.errorString());
	} else {
		QDialog::accept();
	}
}
Beispiel #4
0
void MetadataDialog::fill(const QMap<FF8Installation::Type, FF8Installation> &ff8Installations)
{
	if(ff8Installations.contains(FF8Installation::Steam)) {
		FF8Installation installation = ff8Installations.value(FF8Installation::Steam);
		if(installation.hasMetadata()) {
			QString savePath = installation.savePath(1);
			_path->setText(QDir::toNativeSeparators(savePath + "/metadata.xml"));
			UserDirectory userDir(savePath);
			_userID->setText(userDir.userID());
		}
	}
}
Beispiel #5
0
bool CamuleDlg::Check_and_Init_Skin()
{
	bool ret = true;
	wxString skinFileName(thePrefs::GetSkin());

	if (skinFileName.IsEmpty() || skinFileName.IsSameAs(_("- default -"))) {
		return false;
	}

	wxString userDir(JoinPaths(GetConfigDir(), wxT("skins")) + wxFileName::GetPathSeparator());

	wxStandardPathsBase &spb(wxStandardPaths::Get());
#ifdef __WINDOWS__ 
	wxString dataDir(spb.GetPluginsDir());
#elif defined(__WXMAC__)
		wxString dataDir(spb.GetDataDir());
#else
	wxString dataDir(spb.GetDataDir().BeforeLast(wxT('/')) + wxT("/amule"));
#endif
	wxString systemDir(JoinPaths(dataDir,wxT("skins")) + wxFileName::GetPathSeparator());


	skinFileName.Replace(wxT("User:"******"System:"), systemDir );

	m_skinFileName.Assign(skinFileName);
	if (!m_skinFileName.FileExists()) {
		AddLogLineC(CFormat(
			_("Skin directory '%s' does not exist")) %
			skinFileName );
		ret = false;
	} else if (!m_skinFileName.IsFileReadable()) {
		AddLogLineC(CFormat(
			_("WARNING: Unable to open skin file '%s' for read")) %
			skinFileName);
		ret = false;
	}

	wxFFileInputStream in(m_skinFileName.GetFullPath());
	wxZipInputStream zip(in);
	wxZipEntry *entry;

	while ((entry = zip.GetNextEntry()) != NULL) {
		wxZipEntry*& current = cat[entry->GetInternalName()];
		delete current;
		current = entry;
	}

	return ret;
}
//----------------------------------------------------------------------------
ctkPluginFrameworkDebugOptions::ctkPluginFrameworkDebugOptions()
  : enabled(false)
  , context(NULL)
{
  // if no debug option was specified, don't even bother to try.
  // Must ensure that the options slot is null as this is the signal to the
  // platform that debugging is not enabled.
  QVariant debugOptions = ctkPluginFrameworkProperties::getProperty(CTK_DEBUG);
  if (debugOptions.isNull()) return;

  QString debugOptionsFilename = debugOptions.toString();

  if (debugOptionsFilename.isEmpty())
  {
    // default options location is user.dir (install location may be r/o so
    // is not a good candidate for a trace options that need to be updatable by
    // by the user)
    QDir userDir(ctkPluginFrameworkProperties::getProperty(ctkPluginFrameworkLauncher::PROP_USER_DIR).toString());
    debugOptionsFilename = userDir.absoluteFilePath(OPTIONS);
  }
  QFile optionsFile(debugOptionsFilename);
  QString msgState;
  if (!optionsFile.exists())
  {
    msgState = "not found";
  }
  else
  {
    QSettings settings(debugOptionsFilename, QSettings::IniFormat);
    if (settings.status() != QSettings::NoError)
    {
      msgState = ".... did not parse";
    }
    else
    {
      foreach (const QString& key, settings.allKeys())
      {
        this->options.insert(key, settings.value(key));
      }
      this->enabled = true;
    }
  }
  qDebug() << "Debug options:\n    " << optionsFile.fileName() << "    " << msgState;
}
void WizUpdaterDialog::doOldDatabaseUpgrade()
{
    QDir homeDir(QDir::homePath());
    QString oldDataStorePath = QDir::homePath() + "/WizNote/";
    QString newDataStorePath = QDir::homePath() + "/.wiznote/";

    bool ret = homeDir.rmdir(newDataStorePath);

    if (ret) {
        homeDir.rename(oldDataStorePath, newDataStorePath);
    } else {
        QMessageBox::critical(this, tr("Error"), tr("the .wiznote directory should be empty, please contect R&D team!"));
        return;
    }

    QDir rootDir(newDataStorePath);

    rootDir.remove("wiznote.ini");
    setGuiNotify("Remove wiznote.ini");
    rootDir.remove("wiznote.log");
    setGuiNotify("Remove wiznote.log");

    // enum each user
    CWizStdStringArray folders;
    WizEnumFolders(newDataStorePath, folders, 0);
    foreach (const QString& folder, folders) {
        QDir userDir(folder);

        QString strOldNotes = folder + "Notes/";
        QString strOldAttaches = folder + "Attachments/";

        // rename notes data
        CWizStdStringArray notes;
        WizEnumFiles(strOldNotes, "*.ziw", notes, 0);
        foreach (const QString& note, notes) {
            QDir dirNote(strOldNotes);
            // 36 chars for GUID and 4 chars for extention
            QString strNewName = strOldNotes + "{" + note.right(40).left(36) + "}";
            dirNote.rename(note, strNewName);
            setGuiNotify(QString("Rename %1").arg(note));
        }
Beispiel #8
0
void MetadataDialog::setMetadataPath(const QString &path)
{
	QString metadataPath;

	if(path.isNull()) {
		QStringList filter = QStringList()
				<< tr("Fichiers XML (*.xml)")
				<< tr("Tous les fichiers (*)");
		metadataPath = QFileDialog::getOpenFileName(this, tr("Rechercher metadata.xml"), _path->text(), filter.join(";;"));
		if(metadataPath.isNull()) {
			return;
		}
	} else {
		metadataPath = path;
	}

	_path->setText(QDir::toNativeSeparators(metadataPath));
	if(_userID->text().isEmpty()) {
		UserDirectory userDir(metadataPath.left(metadataPath.lastIndexOf('/')));
		_userID->setText(userDir.userID());
	}
}
Beispiel #9
0
int main()
{
	const Cadena NombreM("Jose Manuel Barba Gonzalez");
	Fecha fecM(21,2,1982);
	Fecha fpubli(1,1,1970);
	Fecha fexp(3,7,2015);
	const Fecha fString("1/1/1970");
	Fecha f;
	const char *user = "******";
	Cadena art_id("110");
	Cadena art_nom("Programación C");
	Cadena cadM(user);
	//Numero Num_tjtM("1234 9840 9482 3847");
//	Numero Num_tjtM("378282246310005");

	Cadena userid("001");
	Cadena userNom("Jose M");
	Cadena userApll("Barba Gonzalez");
	Cadena userDir("su casa");
//	const Clave userPass("holas");
	//istringstream isM("2/4/2006");
	//ostringstream os("");
	cout << "---" << endl;
	//isM >> f;

/*	Usuario userM(userid,userNom,userApll,userDir,userPass);
	Tarjeta TjtM(Num_tjtM,userM,fexp);
	Autor autM(userNom,userApll,userDir);
	Articulo::Autores autores = crea_autores(autM);
	Libro artM(autores,art_id,art_nom,fpubli,50.55,200,100);
	InformeDigital InfDigM(autores,art_id,art_nom,fpubli,50.55,fexp);
*/
	cout << "Main\n" << NombreM << endl << cadM << "." << endl;
	cout << "---Cadena---" << endl;

	cout << "Extraccion: una palabra --- ";
	istringstream is("bueno bonito barato");
	Cadena c("algo");
	is >> c;
	if(c == "bueno" && is.peek() == ' ') cout << "OK." << endl;
	cout << c << endl;

	cout << endl << "---Fecha---" << endl;

	cout << "Fecha de Nacimiento: "; fecM.visualizar();
	cout << "Fecha como cadena: "; fString.visualizar();
Fecha g(--fecM);g.visualizar();g.restadias(3);g.visualizar();
++g;g.visualizar();g.sumadias(2);g.visualizar();
	cout << "---" << endl;
	//f.visualizar();
	//cout << f;

/*	cout << "\n---Articulo Libro---\n" << artM;
	cout << "\n---Articulo InformeDigital---\n" << "A la venta hasta el "; InfDigM.imp_esp(os);
	cout << "\n---Tarjeta---\n" << TjtM.tarjeta() << endl;
	cout << "\n---Usuario---\n" << userM.id() << "|" << userM.nombre() << " " << userM.apellidos() << "|" << userM.direccion() << "|" << userPass.clave() << endl;

	if(userPass.verifica("holas"))
		cout << "Verificada" << endl;
	else
		cout << "No Verificada" << endl;
*/
	return 0;
}