当前位置: 首页>>代码示例>>C++>>正文


C++ savePath函数代码示例

本文整理汇总了C++中savePath函数的典型用法代码示例。如果您正苦于以下问题:C++ savePath函数的具体用法?C++ savePath怎么用?C++ savePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了savePath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: favorite

void searchTab::unfavorite()
{
	Favorite favorite("", 0, QDateTime::currentDateTime());
	for (Favorite fav : m_favorites)
	{
		if (fav.getName() == m_link)
		{
			favorite = fav;
			m_favorites.removeAll(fav);
			break;
		}
	}
	if (favorite.getName().isEmpty())
		return;

	QFile f(savePath("favorites.txt"));
	f.open(QIODevice::ReadOnly);
		QString favs = f.readAll();
	f.close();

	favs.replace("\r\n", "\n").replace("\r", "\n").replace("\n", "\r\n");
	QRegExp reg(QRegExp::escape(favorite.getName()) + "\\|(.+)\\r\\n");
	reg.setMinimal(true);
	favs.remove(reg);

	f.open(QIODevice::WriteOnly);
		f.write(favs.toUtf8());
	f.close();

	if (QFile::exists(savePath("thumbs/" + favorite.getName(true) + ".png")))
	{ QFile::remove(savePath("thumbs/" + favorite.getName(true) + ".png")); }

	_mainwindow->updateFavorites();
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:34,代码来源:search-tab.cpp

示例2: Favorite

/**
 * Update the local favorites file and add thumb if necessary.
 */
void favoriteWindow::save()
{
	Favorite oldFav = favorite;
	favorite = Favorite(ui->tagLineEdit->text(), ui->noteSpinBox->value(), ui->lastViewedDateTimeEdit->dateTime());

	if (QFile::exists(ui->imageLineEdit->text()))
	{
		QPixmap img(ui->imageLineEdit->text());
		if (!img.isNull())
		{ favorite.setImage(img); }
	}
	else if (oldFav.getName() != ui->tagLineEdit->text() && QFile::exists(savePath("thumbs/" + oldFav.getName(true) + ".png")))
	{ QFile::rename(savePath("thumbs/" + oldFav.getName(true) + ".png"), savePath("thumbs/" + favorite.getName(true) + ".png")); }

	QFile f(savePath("favorites.txt"));
	f.open(QIODevice::ReadOnly);
		QString favorites = f.readAll();
	f.close();

	favorites.replace("\r\n", "\n").replace("\r", "\n").replace("\n", "\r\n");
	favorites.remove(oldFav.getName() + "|" + QString::number(oldFav.getNote()) + "|" + oldFav.getLastViewed().toString(Qt::ISODate) + "\r\n");
	favorites += favorite.getName() + "|" + QString::number(favorite.getNote()) + "|" + favorite.getLastViewed().toString(Qt::ISODate) + "\r\n";

	f.open(QIODevice::WriteOnly);
		f.write(favorites.toUtf8());
	f.close();

	emit favoritesChanged();
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:32,代码来源:favoritewindow.cpp

示例3: settings

/**
 * Add a site to the list.
 */
void sourcesWindow::addCheckboxes()
{
	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	QString t = settings.value("Sources/Types", "icon").toString();

	QStringList k = m_sites->keys();
	for (int i = 0; i < k.count(); i++)
	{
		QCheckBox *check = new QCheckBox();
			check->setChecked(m_selected[i]);
			check->setText(k.at(i));
			connect(check, SIGNAL(stateChanged(int)), this, SLOT(checkUpdate()));
			m_checks << check;
			ui->gridLayout->addWidget(check, i, 0);

		int n = 1;
		if (t != "hide")
		{
			if (t == "icon" || t == "both")
			{
				QLabel *image = new QLabel();
				image->setPixmap(QPixmap(savePath("sites/"+m_sites->value(k.at(i))->type()+"/icon.png")));
				ui->gridLayout->addWidget(image, i, n);
				m_labels << image;
				n++;
			}
			if (t == "text" || t == "both")
			{
				QLabel *type = new QLabel(m_sites->value(k.at(i))->value("Name"));
				ui->gridLayout->addWidget(type, i, n);
				m_labels << type;
				n++;
			}
		}

		QBouton *del = new QBouton(k.at(i));
			del->setText(tr("Options"));
			connect(del, SIGNAL(appui(QString)), this, SLOT(settingsSite(QString)));
			m_buttons << del;
			ui->gridLayout->addWidget(del, i, n);
	}

	/*int n =  0+(t == "icon" || t == "both")+(t == "text" || t == "both");
	for (int i = 0; i < m_checks.count(); i++)
	{
		ui->gridLayout->addWidget(m_checks.at(i), i, 0);
		m_checks.at(i)->show();
		if (!m_labels.isEmpty())
		{
			for (int r = 0; r < n; r++)
			{
				ui->gridLayout->addWidget(m_labels.at(i*n+r), i*n+r, 1);
				m_labels.at(i*n+r)->show();
			}
		}
		ui->gridLayout->addWidget(m_buttons.at(i), i, n+1);
		m_buttons.at(i)->show();
	}*/
}
开发者ID:ExKia,项目名称:imgbrd-grabber,代码行数:62,代码来源:sourceswindow.cpp

示例4: QDir

bool Favorite::setImage(QPixmap& img)
{
	if (!QDir(savePath("thumbs")).exists())
		QDir(savePath()).mkdir("thumbs");

	return img
			.scaled(QSize(150,150), Qt::KeepAspectRatio, Qt::SmoothTransformation)
			.save(savePath("thumbs/" + getName(true) + ".png"), "PNG");
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:9,代码来源:favorite.cpp

示例5: QDir

void zoomWindow::setfavorite()
{
	if (!QDir(savePath("thumbs")).exists())
	{ QDir(savePath()).mkdir("thumbs"); }

	if (image != nullptr)
	{
		Favorite fav(link, 50, QDateTime::currentDateTime());
		fav.setImage(*image);
	}

	_mainwindow->updateFavorites();
	_mainwindow->updateFavoritesDock();
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:14,代码来源:zoomwindow.cpp

示例6: ASSERT

std::vector<ImageDesc> ImageDesc::fromPaths(const std::vector<std::string> paths,
                                            const std::string & image_desc_extension) {
    std::vector<ImageDesc> descs;
    for(auto & path: paths) {
        ASSERT(io::exists(path), "File " << path << " does not exists.");
        auto desc = ImageDesc(path);
        desc.setSavePathExtension(image_desc_extension);
        if(io::exists(desc.savePath())) {
            desc = *ImageDesc::load(desc.savePath());
            desc.filename = path;
        }
        descs.push_back(desc);
    }
    return descs;
}
开发者ID:BioroboticsLab,项目名称:deeplocalizer_tagger,代码行数:15,代码来源:Image.cpp

示例7: log

void tagTab::updateCheckboxes()
{
	log(tr("Mise à jour des cases à cocher."));
	qDeleteAll(m_checkboxes);
	m_checkboxes.clear();
	QStringList urls = m_sites->keys();
	QSettings settings(savePath("settings.ini"), QSettings::IniFormat, this);
	int n = settings.value("Sources/Letters", 3).toInt(), m = n;
	for (int i = 0; i < urls.size(); i++)
	{
		if (urls[i].startsWith("www."))
		{ urls[i] = urls[i].right(urls[i].length() - 4); }
		else if (urls[i].startsWith("chan."))
		{ urls[i] = urls[i].right(urls[i].length() - 5); }
		if (n < 0)
		{
			m = urls.at(i).indexOf('.');
			if (n < -1 && urls.at(i).indexOf('.', m+1) != -1)
			{ m = urls.at(i).indexOf('.', m+1); }
		}

		bool isChecked = m_selectedSources.size() > i ? m_selectedSources.at(i) : false;
		QCheckBox *c = new QCheckBox(urls.at(i).left(m), this);
			c->setChecked(isChecked);
			ui->layoutSourcesList->addWidget(c);

		m_checkboxes.append(c);
	}
	DONE();
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:30,代码来源:tag-tab.cpp

示例8: defined

void GlobalOptionsDialog::open() {
	OptionsDialog::open();

#if !( defined(__DC__) || defined(__GP32__) || defined(__PLAYSTATION2__) )
	// Set _savePath to the current save path
	Common::String savePath(ConfMan.get("savepath", _domain));
	Common::String themePath(ConfMan.get("themepath", _domain));
	Common::String extraPath(ConfMan.get("extrapath", _domain));

	if (!savePath.empty()) {
		_savePath->setLabel(savePath);
	} else {
		// Default to the current directory...
		char buf[MAXPATHLEN];
		getcwd(buf, sizeof(buf));
		_savePath->setLabel(buf);
	}

	if (themePath.empty() || !ConfMan.hasKey("themepath", _domain)) {
		_themePath->setLabel("None");
	} else {
		_themePath->setLabel(themePath);
	}

	if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
		_extraPath->setLabel("None");
	} else {
		_extraPath->setLabel(extraPath);
	}
#endif
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:31,代码来源:options.cpp

示例9: getSavePath

bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
	Common::String savePathName = getSavePath();
	checkPath(Common::FSNode(savePathName));
	if (getError().getCode() != Common::kNoError)
		return false;

	// recreate FSNode since checkPath may have changed/created the directory
	Common::FSNode savePath(savePathName);

	Common::FSNode file = savePath.getChild(filename);

	// FIXME: remove does not exist on all systems. If your port fails to
	// compile because of this, please let us know (scummvm-devel or Fingolfin).
	// There is a nicely portable workaround, too: Make this method overloadable.
	if (remove(file.getPath().c_str()) != 0) {
#ifndef _WIN32_WCE
		if (errno == EACCES)
			setError(Common::kWritePermissionDenied, "Search or write permission denied: "+file.getName());

		if (errno == ENOENT)
			setError(Common::kPathDoesNotExist, "removeSavefile: '"+file.getName()+"' does not exist or path is invalid");
#endif
		return false;
	} else {
		return true;
	}
}
开发者ID:0xf1sh,项目名称:scummvm,代码行数:27,代码来源:default-saves.cpp

示例10: GetOriginalSavePath

// get a xliveless-compatible save game directory
static std::wstring GetOriginalSavePath()
{
	PWSTR documentsPath;

	// get the Documents folder
	if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &documentsPath)))
	{
		// put it into a string and free it
		std::wstring savePath(documentsPath);

		CoTaskMemFree(documentsPath);
		
		// append the R* bits
		AppendPathComponent(savePath, L"\\Rockstar Games");
		AppendPathComponent(savePath, L"\\GTA IV");
		AppendPathComponent(savePath, L"\\savegames");

		// append a final separator
		savePath += L"\\";

		// and return the path
		return savePath;
	}

	// if not working, panic
	FatalError("Could not get Documents folder path for save games.");
}
开发者ID:ghost30812,项目名称:client,代码行数:28,代码来源:NorthSaveData.cpp

示例11: GetCitizenSavePath

// get our Citizen save game directory
static std::wstring GetCitizenSavePath()
{
	PWSTR saveBasePath;

	// get the 'Saved Games' shell directory
	if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_SavedGames, 0, nullptr, &saveBasePath)))
	{
		// create a STL string and free the used memory
		std::wstring savePath(saveBasePath);

		CoTaskMemFree(saveBasePath);

		// append our path components
		AppendPathComponent(savePath, L"\\CitizenFX");
		AppendPathComponent(savePath, L"\\GTA4");

		// append a final separator
		savePath += L"\\";

		// and return the path
		return savePath;
	}

	return GetOriginalSavePath();
}
开发者ID:ghost30812,项目名称:client,代码行数:26,代码来源:NorthSaveData.cpp

示例12: settings

void zoomWindow::openSaveDir(bool fav)
{
	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	QString path = settings.value("Save/path"+QString(fav ? "_favorites" : "")).toString().replace("\\", "/"), fn = settings.value("Save/filename"+QString(fav ? "_favorites" : "")).toString();

	if (path.right(1) == "/")
	{ path = path.left(path.length()-1); }
	path = QDir::toNativeSeparators(path);

    QStringList files = m_image->path(fn, path);
	QString file = files.empty() ? "" : files.at(0);
	QString pth = file.section(QDir::toNativeSeparators("/"), 0, -2);
	QString url = path+QDir::toNativeSeparators("/")+pth;

	QDir dir(url);
	if (dir.exists())
	{ showInGraphicalShell(url); }
	else
	{
		int reply = QMessageBox::question(this, tr("Dossier inexistant"), tr("Le dossier de sauvegarde n'existe pas encore. Le creer ?"), QMessageBox::Yes | QMessageBox::No);
		if (reply == QMessageBox::Yes)
		{
			QDir dir(path);
			if (!dir.mkpath(pth))
			{ error(this, tr("Erreur lors de la création du dossier.\r\n%1").arg(url)); }
			showInGraphicalShell(url);
		}
	}
}
开发者ID:larry-he,项目名称:imgbrd-grabber,代码行数:29,代码来源:zoomwindow.cpp

示例13: DumpCallback

bool DumpCallback(const char* _dump_dir,const char* _minidump_id,void *context, bool success)
#endif
{
	QString dir, mid;
	Q_UNUSED(context);
	#if defined(Q_OS_WIN)
		dir = QString::fromWCharArray(_dump_dir);
		mid = QString::fromWCharArray(_minidump_id);
		Q_UNUSED(_dump_dir);
		Q_UNUSED(_minidump_id);
		Q_UNUSED(assertion);
		Q_UNUSED(exinfo);
	#elif defined(Q_OS_LINUX)
		dir = QString(md.directory().c_str());
		mid = QString::number(md.fd());
	#elif defined(Q_OS_MAC)
		dir = QString::fromWCharArray(_dump_dir);
		mid = QString::fromWCharArray(_minidump_id);
	#endif

	log(QObject::tr("Minidump sauvegardé dans le dossier \"%1\" avec l'id \"%2\" (%3)").arg(dir, mid, success ? QObject::tr("réussite") : QObject::tr("échec")));
	if (success)
	{
		QFile f(savePath("lastdump"));
		if (f.open(QFile::WriteOnly))
		{
			f.write(QDir::toNativeSeparators(dir+"/"+mid+".dmp").toLatin1());
			f.close();
		}
	}
	QProcess::startDetached("CrashReporter.exe");

	return CrashHandlerPrivate::bReportCrashesToSystem ? success : true;
}
开发者ID:ExKia,项目名称:imgbrd-grabber,代码行数:34,代码来源:crashhandler.cpp

示例14: QDialog

/**
 * Constructor of the sourcesWindow, generating checkboxes and delete buttons
 * @param	selected	Bool list of currently selected websites, in the alphabetical order
 * @param	sites		QStringList of sites names
 * @param	parent		The parent window
 */
sourcesWindow::sourcesWindow(QList<bool> selected, QMap<QString, Site*> *sites, QWidget *parent) : QDialog(parent), ui(new Ui::sourcesWindow), m_selected(selected), m_sites(sites)
{
	ui->setupUi(this);

	bool checkall = true;
	for (int i = 0; i < selected.count(); i++)
	{
		if (!selected.at(i))
		{
			checkall = false;
			break;
		}
	}
	if (checkall)
	{ ui->checkBox->setChecked(true); }

    QSettings settings(savePath("settings.ini"), QSettings::IniFormat);

	addCheckboxes();

	ui->gridLayout->setColumnStretch(0, 1);
	connect(ui->checkBox, SIGNAL(clicked()), this, SLOT(checkClicked()));
	checkUpdate();

	// Check for updates in the model files
	checkForUpdates();

	ui->buttonOk->setFocus();
}
开发者ID:ExKia,项目名称:imgbrd-grabber,代码行数:35,代码来源:sourceswindow.cpp

示例15: savePath

bool Ps2SaveFileManager::removeSavefile(const Common::String &filename) {
	Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
	Common::FSNode file;

	if (!savePath.exists() || !savePath.isDirectory())
		return false;

	if (_getDev(savePath) == MC_DEV) {
	// if (strncmp(savePath.getPath().c_str(), "mc0:", 4) == 0) {
		char path[32], temp[32];
		strcpy(temp, filename.c_str());

		// mcSplit(temp, game, ext);
		char *game = strdup(strtok(temp, "."));
		char *ext = strdup(strtok(NULL, "*"));
		sprintf(path, "mc0:ScummVM/%s", game); // per game path
		mcCheck(path);
		sprintf(path, "mc0:ScummVM/%s/%s.sav", game, ext);
		file = Common::FSNode(path);
		free(game);
		free(ext);
	} else {
		file = savePath.getChild(filename);
	}

	if (!file.exists() || file.isDirectory())
		return false;

	fio.remove(file.getPath().c_str());

	return true;
}
开发者ID:33d,项目名称:scummvm,代码行数:32,代码来源:savefilemgr.cpp


注:本文中的savePath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。