本文整理汇总了C++中QFileInfo::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfo::fileName方法的具体用法?C++ QFileInfo::fileName怎么用?C++ QFileInfo::fileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfo
的用法示例。
在下文中一共展示了QFileInfo::fileName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fi
TasksDialog::TasksDialog(DialogAction action, ObjectActionList fileNamesActions, QWidget *parent) :
QDialog(parent),
m_fileNamesActions(fileNamesActions),
m_taskListReceived(false),
m_currentAction(action),
m_chosenTask(QLatin1String("")),
ui(new Ui::TasksDialog),
m_pendingActions(0)
{
ui->setupUi(this);
ui->stackedWidget->setCurrentIndex(1);
connect(this, SIGNAL(setConnectionDialogVisibility(bool)),
SynergyPlugin::instance(), SLOT(setConnectionDialogVisibilitySlot(bool)));
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
if (m_currentAction == Show || m_currentAction == Indicate)
connect(ui->okButton, SIGNAL(clicked()), this, SLOT(accept()));
else
connect(ui->okButton, SIGNAL(clicked()), this, SLOT(addObjectsToTask()));
connect(ui->newTaskButton, SIGNAL(clicked()), this, SLOT(startTaskWizard()));
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(openContextMenu(QPoint)));
connect(ui->treeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)),
this, SLOT(itemExpandedSlot(QTreeWidgetItem*)));
connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(itemClicked(QTreeWidgetItem*)));
// Disable OK button if Action == Indicate
if (Indicate == m_currentAction)
ui->okButton->setEnabled(false);
if (! fileNamesActions.isEmpty())
{
const QFileInfo fi(fileNamesActions.first().first);
m_workingDir = fi.absolutePath();
setWindowTitle(fi.fileName());
}
else
{
m_workingDir = QLatin1String("C:\\");
}
ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
// ui->treeWidget->setDragEnabled(true);
emit setConnectionDialogVisibility(true);
if (!SynergyPlugin::instance()->isSynergyStarted())
{
WorkerThreadPair workerThread = SynergyPlugin::instance()->startSynergyAsync(m_workingDir);
connect(workerThread.first, SIGNAL(resultDownloaded(SynergyResponse)),
this, SLOT(refreshTaskList()));
}
else
{
refreshTaskList();
}
}
示例2: addViewName
void ViewTableListWidget::addViewName(QString str)
{
qDebug()<<tr("信号发射成功")<<str;
QDir rootdir("view//");
rootdir.setFilter(rootdir.filter()|QDir::NoDotAndDotDot);
QStringList strings;
strings<<str;
QFileInfo tempinfo = *(rootdir.entryInfoList(strings).begin());
qDebug()<<tempinfo.absolutePath();
this->insertRow(rowCount());
int temprow = rowCount()-1;
QTableWidgetItem * item = new QTableWidgetItem(QIcon("images/historicalcurve.jpg"),tempinfo.fileName());
item->setToolTip(item->text());
this->setItem(temprow,0,item);
this->setItem(temprow,1,new QTableWidgetItem(tempinfo.suffix()));
item = new QTableWidgetItem("0");
item->setTextAlignment(Qt::AlignCenter);
this->setItem(temprow,2,item);
item = new QTableWidgetItem(tempinfo.lastModified().toString("yyyy-MM-dd hh:mm"));
item->setTextAlignment(Qt::AlignCenter);
this->setItem(temprow,3,item);
modifyViewTable();
}
示例3: parse_command
static void parse_command(QString cmdline, const QString &id, const QString &whichCommand,
QString *command, QStringList *prefix, QStringList *suffix, ArchiveDefinition::ArgumentPassingMethod *method, bool parseFilePlaceholder)
{
Q_ASSERT(prefix);
Q_ASSERT(suffix);
Q_ASSERT(method);
KShell::Errors errors;
QStringList l;
if (cmdline.startsWith(NULL_SEPARATED_STDIN_INDICATOR)) {
*method = ArchiveDefinition::NullSeparatedInputFile;
cmdline.remove(0, 2);
} else if (cmdline.startsWith(NEWLINE_SEPARATED_STDIN_INDICATOR)) {
*method = ArchiveDefinition::NewlineSeparatedInputFile;
cmdline.remove(0, 1);
} else {
*method = ArchiveDefinition::CommandLine;
}
if (*method != ArchiveDefinition::CommandLine && cmdline.contains(FILE_PLACEHOLDER)) {
throw ArchiveDefinitionError(id, i18n("Cannot use both %f and | in '%1'", whichCommand));
}
cmdline.replace(FILE_PLACEHOLDER, QLatin1String("__files_go_here__"))
.replace(INSTALLPATH_PLACEHOLDER, QStringLiteral("__path_goes_here__"));
l = KShell::splitArgs(cmdline, KShell::AbortOnMeta | KShell::TildeExpand, &errors);
l = l.replaceInStrings(QStringLiteral("__files_go_here__"), FILE_PLACEHOLDER);
if (l.indexOf(QRegExp(QLatin1String(".*__path_goes_here__.*"))) >= 0) {
l = l.replaceInStrings(QStringLiteral("__path_goes_here__"), ArchiveDefinition::installPath());
}
if (errors == KShell::BadQuoting) {
throw ArchiveDefinitionError(id, i18n("Quoting error in '%1' entry", whichCommand));
}
if (errors == KShell::FoundMeta) {
throw ArchiveDefinitionError(id, i18n("'%1' too complex (would need shell)", whichCommand));
}
qCDebug(KLEOPATRA_LOG) << "ArchiveDefinition[" << id << ']' << l;
if (l.empty()) {
throw ArchiveDefinitionError(id, i18n("'%1' entry is empty/missing", whichCommand));
}
const QFileInfo fi1(l.front());
if (fi1.isAbsolute()) {
*command = try_extensions(l.front());
} else {
*command = QStandardPaths::findExecutable(fi1.fileName());
}
if (command->isEmpty()) {
throw ArchiveDefinitionError(id, i18n("'%1' empty or not found", whichCommand));
}
if (parseFilePlaceholder) {
const int idx1 = l.indexOf(FILE_PLACEHOLDER);
if (idx1 < 0) {
// none -> append
*prefix = l.mid(1);
} else {
*prefix = l.mid(1, idx1 - 1);
*suffix = l.mid(idx1 + 1);
}
} else {
*prefix = l.mid(1);
}
switch (*method) {
case ArchiveDefinition::CommandLine:
qCDebug(KLEOPATRA_LOG) << "ArchiveDefinition[" << id << ']' << *command << *prefix << FILE_PLACEHOLDER << *suffix;
break;
case ArchiveDefinition::NewlineSeparatedInputFile:
qCDebug(KLEOPATRA_LOG) << "ArchiveDefinition[" << id << ']' << "find | " << *command << *prefix;
break;
case ArchiveDefinition::NullSeparatedInputFile:
qCDebug(KLEOPATRA_LOG) << "ArchiveDefinition[" << id << ']' << "find -print0 | " << *command << *prefix;
break;
case ArchiveDefinition::NumArgumentPassingMethods:
Q_ASSERT(!"Should not happen");
break;
}
}
示例4: getMaskToConfig
QString OptionsWindow::getMaskToConfig(int step) {
QString mask;
QSettings *GlobalSettings = new QSettings("/root/.WiFiHostapdAP/WiFi_Hostapd_AP.conf",QSettings::NativeFormat); // создание нового объекта
QDir dir;
QFileInfoList list;
QString temp_qstring = "default.conf";
QString path;
switch(step) {
case 0:
dir.cd("/root");
if(!dir.cd(".WiFiHostapdAP")) {
dir.mkdir(QString("%1").arg(".WiFiHostapdAP"));
dir.cd(".WiFiHostapdAP"); }
if(!dir.cd("./Mask/")) {
dir.mkdir(QString("%1").arg("Mask"));
dir.cd("./Mask/"); }
if(!dir.cd("./hostapd/")) {
dir.mkdir(QString("%1").arg("hostapd"));
dir.cd("./hostapd/"); }
dir.setFilter(QDir::Files);
list = dir.entryInfoList();
if(list.size()==0) {
QFile new_Default_Mask("/root/.WiFiHostapdAP/Mask/hostapd/default.conf");
new_Default_Mask.open(QIODevice::Append | QIODevice::Text);
QTextStream out(&new_Default_Mask);
out << "#Name:Default\n";
out << "#Type:Hostapd\n";
out << "interface=[INTERFACE]\n";
out << "driver=[DRIVER]\n";
out << "ssid=[SSID]\n";
out << "country_code=[COUNTRY_CODE]\n";
out << "[TYPE_AP]\n";
out << "channel=[CHANNEL]\n";
out << "macaddr_acl=0\n";
out << "[HIDEAP]\n";
out << "[PROTECT]";
new_Default_Mask.close();
list.clear();
dir.setFilter(QDir::Files);
list = dir.entryInfoList();
}
path = "/root/.WiFiHostapdAP/Mask/hostapd/";
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
if(fileInfo.fileName() == GlobalSettings->value("AP/ConfigMask", "default.conf").toString())
temp_qstring = GlobalSettings->value("AP/ConfigMask", "default.conf").toString();
}
path += temp_qstring;
break;
case 1:
dir.cd("/root");
if(!dir.cd(".WiFiHostapdAP")) {
dir.mkdir(QString("%1").arg(".WiFiHostapdAP"));
dir.cd(".WiFiHostapdAP"); }
if(!dir.cd("./Mask/")) {
dir.mkdir(QString("%1").arg("Mask"));
dir.cd("./Mask/"); }
if(!dir.cd("./dnsmasq/")) {
dir.mkdir(QString("%1").arg("dnsmasq"));
dir.cd("./dnsmasq/"); }
dir.setFilter(QDir::Files);
list = dir.entryInfoList();
if(list.size()==0) {
// Если шаблонов нет, то создаём шаблон по-умолчанию
QFile new_Default_Mask("/root/.WiFiHostapdAP/Mask/dnsmasq/default.conf");
new_Default_Mask.open(QIODevice::Append | QIODevice::Text);
QTextStream out(&new_Default_Mask);
out << "#Name:Default\n";
out << "#Type:DNSMASQ\n";
out << "interface=[INTERFACE]\n";
out << "dhcp-range=[RANGE_1],[RANGE_2],[IP_TIME];\n";
out<< "[OpenDNS]";
new_Default_Mask.close();
list.clear();
dir.setFilter(QDir::Files);
list = dir.entryInfoList();
}
path = "/root/.WiFiHostapdAP/Mask/dnsmasq/";
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
if(fileInfo.fileName() == GlobalSettings->value("AP/ConfigMask1", "default.conf").toString())
temp_qstring = GlobalSettings->value("AP/ConfigMask1", "default.conf").toString();
//.........这里部分代码省略.........
示例5: upload
void MegaUploader::upload(QFileInfo info, MegaNode *parent)
{
QApplication::processEvents();
MegaNodeList *children = megaApi->getChildren(parent);
QByteArray utf8name = info.fileName().toUtf8();
QString currentPath = QDir::toNativeSeparators(info.absoluteFilePath());
MegaNode *dupplicate = NULL;
for (int i = 0; i < children->size(); i++)
{
MegaNode *child = children->get(i);
if (!strcmp(utf8name.constData(), child->getName())
&& ((info.isDir() && (child->getType() == MegaNode::TYPE_FOLDER))
|| (info.isFile() && (child->getType() == MegaNode::TYPE_FILE)
&& (info.size() == child->getSize()))))
{
dupplicate = child->copy();
break;
}
}
delete children;
if (dupplicate)
{
if (dupplicate->getType() == MegaNode::TYPE_FILE)
{
emit dupplicateUpload(info.absoluteFilePath(), info.fileName(), dupplicate->getHandle());
}
if (dupplicate->getType() == MegaNode::TYPE_FOLDER)
{
QDir dir(info.absoluteFilePath());
QFileInfoList entries = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
for (int i = 0; i < entries.size(); i++)
{
upload(entries[i], dupplicate);
}
}
delete dupplicate;
return;
}
string localPath = megaApi->getLocalPath(parent);
if (localPath.size() && megaApi->isSyncable(info.fileName().toUtf8().constData()))
{
#ifdef WIN32
QString destPath = QDir::toNativeSeparators(QString::fromWCharArray((const wchar_t *)localPath.data()) + QDir::separator() + info.fileName());
if (destPath.startsWith(QString::fromAscii("\\\\?\\")))
{
destPath = destPath.mid(4);
}
#else
QString destPath = QDir::toNativeSeparators(QString::fromUtf8(localPath.data()) + QDir::separator() + info.fileName());
#endif
megaApi->moveToLocalDebris(destPath.toUtf8().constData());
QtConcurrent::run(Utilities::copyRecursively, currentPath, destPath);
}
else if (info.isFile())
{
megaApi->startUpload(currentPath.toUtf8().constData(), parent);
}
else if (info.isDir())
{
folders.enqueue(info);
megaApi->createFolder(info.fileName().toUtf8().constData(), parent, delegateListener);
}
}
示例6: execute
bool NewMapFile::execute()
{
PIDGIRL::writeLog("Creating new map file");
bool ok = false;
QFileInfo fileInfo = QFileInfo(this->worldModel->filePath(this->index));
this->dir = fileInfo.dir();
if(fileInfo.isDir())
{
dir.cd(fileInfo.fileName());
}
this->file = QInputDialog::getText(0,
tr("New Map..."),
tr("Enter the name of the new map."),
QLineEdit::Normal,
tr("New Map"),
&ok);
if(!ok)
{
PIDGIRL::writeLogDone("[EXIT]");
return true;
}
if(this->file.isEmpty())
{
PIDGIRL::writeLogFail("No file was specified. The string, where the path should've been, was empty.");
return false;
}
if(this->file.endsWith(PIDGIRL::MAP_SUFFIX))
{
this->file.remove(this->file.size() - PIDGIRL::MAP_SUFFIX.size(), PIDGIRL::MAP_SUFFIX.size());
}
int i = 1;
QString newFile = this->file;
while(dir.exists(newFile.append(PIDGIRL::MAP_SUFFIX)))
{
newFile = this->file;
newFile = newFile.append(QString::number(i));
++i;
}
MapModel tempMap;
QString mapPath = QFileInfo(this->dir, newFile).absoluteFilePath();
tempMap.setLocalMapPath(this->worldModel->absoluteMapPathToLocalMapPath(mapPath));
if(!this->fileManager.serialize(&tempMap, mapPath))
{
QMessageBox::critical(0, tr("Failed to create a map file..."), tr("Creating a map file has failed."));
PIDGIRL::writeLogFail("The creating process of the map failed.");
return false;
}
PIDGIRL::writeLogDone();
return true;
}
示例7: findFile
/*!
\a fileName is the path of the file to find.
\a files and \a dirs are the lists where we must find the
components of \a fileName.
\a location is used for obtaining the file and line numbers
for report qdoc errors.
*/
QString Config::findFile(const Location& location,
const QStringList& files,
const QStringList& dirs,
const QString& fileName,
QString& userFriendlyFilePath)
{
if (fileName.isEmpty() || fileName.startsWith(QLatin1Char('/'))) {
userFriendlyFilePath = fileName;
return fileName;
}
QFileInfo fileInfo;
QStringList components = fileName.split(QLatin1Char('?'));
QString firstComponent = components.first();
QStringList::ConstIterator f = files.begin();
while (f != files.end()) {
if (*f == firstComponent ||
(*f).endsWith(QLatin1Char('/') + firstComponent)) {
fileInfo.setFile(*f);
if (!fileInfo.exists())
location.fatal(tr("File '%1' does not exist").arg(*f));
break;
}
++f;
}
if (fileInfo.fileName().isEmpty()) {
QStringList::ConstIterator d = dirs.begin();
while (d != dirs.end()) {
fileInfo.setFile(QDir(*d), firstComponent);
if (fileInfo.exists()) {
break;
}
++d;
}
}
userFriendlyFilePath = QString();
if (!fileInfo.exists())
return QString();
QStringList::ConstIterator c = components.begin();
for (;;) {
bool isArchive = (c != components.end() - 1);
QString userFriendly = *c;
userFriendlyFilePath += userFriendly;
if (isArchive) {
QString extracted = extractedDirs[fileInfo.filePath()];
++c;
fileInfo.setFile(QDir(extracted), *c);
}
else
break;
userFriendlyFilePath += "?";
}
return fileInfo.filePath();
}
示例8: processXmlFile
bool processXmlFile(const QString &xmlFile)
{
QFile file(xmlFile);
if (!file.open(QIODevice::ReadOnly))
return false;
const QLatin1String tag_app("app");
const QLatin1String attrib_mainQmlFile("mainqmlfile");
const QLatin1String attrib_projectPath("projectpath");
const QLatin1String attrib_projectName("projectname");
const QLatin1String attrib_screenOrientation("screenorientation");
const QLatin1String value_screenOrientationLockLandscape("LockLandscape");
const QLatin1String value_screenOrientationLockPortrait("LockPortrait");
const QLatin1String attrib_networkAccess("networkaccess");
static const QString qtDir =
QLibraryInfo::location(QLibraryInfo::PrefixPath) + QLatin1Char('/');
QXmlStreamReader reader(&file);
while (!reader.atEnd()) {
const QXmlStreamReader::TokenType token = reader.readNext();
switch (token) {
case QXmlStreamReader::StartElement:
if (reader.name() == tag_app) {
QtQuickApp app;
QFileInfo projectPath;
if (!reader.attributes().hasAttribute(attrib_projectPath)) {
qDebug() << "Project without path found";
continue;
}
projectPath = qtDir + reader.attributes().value(attrib_projectPath).toString();
app.setProjectPath(projectPath.absoluteFilePath());
if (reader.attributes().hasAttribute(attrib_mainQmlFile)) {
const QFileInfo qmlFileOrigin(
qtDir + reader.attributes().value(attrib_mainQmlFile).toString());
if (!qmlFileOrigin.exists()) {
qDebug() << "Cannot find" <<
QDir::toNativeSeparators(qmlFileOrigin.absoluteFilePath());
continue;
}
const QFileInfo qmlTargetPath(QString(projectPath.absoluteFilePath()
+ QLatin1Char('/') + qmlFileOrigin.baseName()
+ QLatin1String("/qml")));
#ifdef Q_OS_WIN
const QString sourcePath =
QDir::toNativeSeparators(qmlFileOrigin.canonicalPath() + QLatin1String("/*"));
const QString targetPath =
QDir::toNativeSeparators(qmlTargetPath.absoluteFilePath() + QLatin1Char('/'));
QProcess xcopy;
QStringList parameters;
parameters << QLatin1String("/E") << sourcePath << targetPath;
xcopy.start(QLatin1String("xcopy.exe"), parameters);
if (!xcopy.waitForStarted() || !xcopy.waitForFinished()) {
qDebug() << "Could not copy" <<
QDir::toNativeSeparators(sourcePath);
continue;
}
#else // Q_OS_WIN
// Implement me!
#endif // Q_OS_WIN
app.setMainQmlFile(qmlTargetPath.absoluteFilePath()
+ QLatin1Char('/') + qmlFileOrigin.fileName());
}
app.setProjectName(reader.attributes().hasAttribute(attrib_projectName)
? reader.attributes().value(attrib_projectName).toString()
: QFileInfo(app.mainQmlFile()).baseName());
if (reader.attributes().hasAttribute(attrib_screenOrientation)) {
const QStringRef orientation = reader.attributes().value(attrib_screenOrientation);
app.setOrientation(orientation == value_screenOrientationLockLandscape ?
AbstractMobileApp::ScreenOrientationLockLandscape
: orientation == value_screenOrientationLockPortrait ?
AbstractMobileApp::ScreenOrientationLockPortrait
: AbstractMobileApp::ScreenOrientationAuto);
}
if (reader.attributes().hasAttribute(attrib_networkAccess))
app.setNetworkEnabled(
reader.attributes().value(attrib_networkAccess).toString() == QLatin1String("true"));
if (!app.generateFiles(0))
qDebug() << "Unable to generate the files for" << app.projectName();
}
break;
default:
break;
}
}
return true;
}
示例9: RefreshView
void CTile_browser_dlg::RefreshView()
{
thread_actif = 1;
//Remove Tiles from the View model
tileViewModel->removeAllTiles();
//Add Tiles in the View model
int listCount = browserModel.GetSize(tileTypeButtonGroup->checkedId());
tilelist::iterator p = browserModel.GetFirst(tileTypeButtonGroup->checkedId());
for (p = browserModel.GetFirst(tileTypeButtonGroup->checkedId()); p != browserModel.GetLast(tileTypeButtonGroup->checkedId()); p++)
{
std::vector<NLMISC::CBGRA>* bits;
bool tileLoaded = false;
std::string tilePath;
switch(tileTextureButtonGroup->checkedId())
{
case Diffuse:
bits = &p->Bits;
tileLoaded = p->loaded;
tilePath = p->path;
break;
case Additive:
bits = &p->nightBits;
tileLoaded = p->nightLoaded;
tilePath = p->nightPath;
break;
case Alpha:
bits = &p->alphaBits;
tileLoaded = p->alphaLoaded;
tilePath = p->alphaPath;
break;
}
if (tileLoaded)
{
int itBufferPixel = 0;
double bufferWidth = sqrt((double)(*bits).size());
double bufferHeight = sqrt((double)(*bits).size());
QImage image(QSize(bufferWidth,bufferHeight), QImage::Format_ARGB32 );
for(int colIndex = 0;colIndex<bufferHeight;colIndex++)
{
for(int lineIndex = 0;lineIndex<bufferWidth;lineIndex++)
{
image.setPixel(lineIndex,colIndex,qRgb((*bits)[itBufferPixel].R
,(*bits)[itBufferPixel].G
,(*bits)[itBufferPixel].B));
itBufferPixel ++;
}
}
image = image.scaled(tileZoomButtonGroup->checkedId() * (tileTypeButtonGroup->checkedId()==_256x256 ? 2 : 1), tileZoomButtonGroup->checkedId() * (tileTypeButtonGroup->checkedId()==_256x256 ? 2 : 1));
QString fileInfo = QString::number(p->getId());
if (tileLabelButtonGroup->checkedId() == CTile_browser_dlg::FileName)
{
QFileInfo fi = QFileInfo(QString( tilePath.c_str()));
fileInfo = fi.fileName();
}
QPixmap pixmap = QPixmap::fromImage(image);
TileModel tile = TileModel(pixmap, fileInfo, p->getId());
tileViewModel->addTile(tile);
}
else
{
QString fileInfo;
if (tileLabelButtonGroup->checkedId() == CTile_browser_dlg::Index)
{
fileInfo = QString::number(p->getId());
}
TileModel tile = TileModel(tileZoomButtonGroup->checkedId() * (tileTypeButtonGroup->checkedId()==_256x256 ? 2 : 1), fileInfo, p->getId());
tileViewModel->addTile(tile);
}
tileViewModel->sort();
}
EnableBrowserInteractions();
thread_actif = 0;
}
示例10: WinXP
void WinXP(QString input, QString out)
{
int per, i, schetchik, k, m, j;
QString FullPath, buff, Avatars, Thumbnails;
QDir dirU(input + "/Documents and Settings");
dirU.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden );
dirU.setSorting(QDir::Name);
QFileInfoList Uslist = dirU.entryInfoList();
QString Users[Uslist.size()];
for (per = 0; per < Uslist.size(); per++)
{
QFileInfo fileInfo = Uslist.at(per);
Users[per] = input + "/Documents and Settings/" + fileInfo.fileName();
}
for (i = 0; i < Uslist.size(); i++)
{
if ((Users[i] != input + "/Documents and Settings/All Users") && (Users[i] != input + "/Documents and Settings/Default User") && (Users[i] != input + "/Documents and Settings/Public") && (Users[i] != input + "/Documents and Settings/Все пользователи"))
{
QDir dirUAR(Users[i] + "/Application Data");
dirUAR.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden );
dirUAR.setSorting(QDir::Name);
QFileInfoList Brlist = dirUAR.entryInfoList();
QString buffRoaming[Brlist.size()];
schetchik = 0;
for (per = 0; per < Brlist.size(); per++)
{
QFileInfo fileInfo = Brlist.at(per);
buffRoaming[per] = Users[i] + "/Application Data/" + fileInfo.fileName();
schetchik++;
}
for (k = 0; k < schetchik; k++)
{
if (buffRoaming[k] == Users[i] + "/Application Data/ViberPC")
{
QDir dirVib(buffRoaming[k]);
dirVib.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden );
dirVib.setSorting(QDir::Name);
QFileInfoList Viblist = dirVib.entryInfoList();
QString Vibakk[Viblist.size()];
QString KatalogiViber[Viblist.size()];
for (m = 0; m < Viblist.size(); m++)
{
QFileInfo fileInfo = Viblist.at(m);
Vibakk[m] = buffRoaming[k] + "/" + fileInfo.fileName();
KatalogiViber[m] = fileInfo.fileName();
}
for (j = 0; j < m; j++)
{
buff = "";
buff = KatalogiViber[j];
if ((buff[0] == '7') &&(buff[1] == '9'))
{
Avatars = Vibakk[j] + "/Avatars";
Thumbnails = Vibakk[j] + "/Thumbnails";
FullPath = Vibakk[j] + "/" + "viber.db";
Viber_XP_7_8_10(FullPath, KatalogiViber[j], out);
Viber_Avatars(Avatars, KatalogiViber[j], out);
Viber_Thumbnails(Thumbnails, KatalogiViber[j], out);
}
}
}
}
}
}
}
示例11: repath
void Mod::repath(const QFileInfo &file)
{
m_file = file;
QString name_base = file.fileName();
m_type = Mod::MOD_UNKNOWN;
if (m_file.isDir())
{
m_type = MOD_FOLDER;
m_name = name_base;
m_mmc_id = name_base;
}
else if (m_file.isFile())
{
if (name_base.endsWith(".disabled"))
{
m_enabled = false;
name_base.chop(9);
}
else
{
m_enabled = true;
}
m_mmc_id = name_base;
if (name_base.endsWith(".zip") || name_base.endsWith(".jar"))
{
m_type = MOD_ZIPFILE;
name_base.chop(4);
}
else if (name_base.endsWith(".litemod"))
{
m_type = MOD_LITEMOD;
name_base.chop(8);
}
else
{
m_type = MOD_SINGLEFILE;
}
m_name = name_base;
}
if (m_type == MOD_ZIPFILE)
{
QuaZip zip(m_file.filePath());
if (!zip.open(QuaZip::mdUnzip))
return;
QuaZipFile file(&zip);
if (zip.setCurrentFile("mcmod.info"))
{
if (!file.open(QIODevice::ReadOnly))
{
zip.close();
return;
}
ReadMCModInfo(file.readAll());
file.close();
zip.close();
return;
}
else if (zip.setCurrentFile("forgeversion.properties"))
{
if (!file.open(QIODevice::ReadOnly))
{
zip.close();
return;
}
ReadForgeInfo(file.readAll());
file.close();
zip.close();
return;
}
zip.close();
}
else if (m_type == MOD_FOLDER)
{
QFileInfo mcmod_info(PathCombine(m_file.filePath(), "mcmod.info"));
if (mcmod_info.isFile())
{
QFile mcmod(mcmod_info.filePath());
if (!mcmod.open(QIODevice::ReadOnly))
return;
auto data = mcmod.readAll();
if (data.isEmpty() || data.isNull())
return;
ReadMCModInfo(data);
}
}
else if (m_type == MOD_LITEMOD)
{
QuaZip zip(m_file.filePath());
if (!zip.open(QuaZip::mdUnzip))
return;
QuaZipFile file(&zip);
//.........这里部分代码省略.........
示例12: getCapturedFileName
QString MaidFacade::getCapturedFileName(const QFileInfo& saveFile) {
//if (!viewport)
// return saveFile.fileName();
qDebug() << "saving captured image...";
//DkImageLoader* loader = viewport->getImageLoader();
QString selectedFilter;
QString saveName;
saveName = saveFile.fileName();
int filterIdx = -1;
// do not use the nomacs saveFilters here, the file format is already set
QStringList sF;
sF.append("Nikon (*.nef)");
sF.append("JPEG (*.jpg *.jpeg)");
//qDebug() << sF;
QRegExp exp = QRegExp("*." + saveFile.suffix() + "*", Qt::CaseInsensitive);
exp.setPatternSyntax(QRegExp::Wildcard);
//qDebug() << "exp: " << exp;
for (int idx = 0; idx < sF.size(); idx++) {
if (exp.exactMatch(sF.at(idx))) {
selectedFilter = sF.at(idx);
filterIdx = idx;
break;
}
}
if (filterIdx == -1)
saveName.remove("." + saveFile.suffix());
QString fileName;
//int answer = QDialog::Rejected;
//if (!selectedFilter.isEmpty() && viewport()->getImageLoader()->isEdited()) {
// fileName = loader->getCurrentImage()->file().absoluteFilePath();
// DkMessageBox* msg = new DkMessageBox(QMessageBox::Question, tr("Overwrite File"),
// tr("Do you want to overwrite:\n%1?").arg(fileName),
// (QMessageBox::Yes | QMessageBox::No), this);
// msg->setObjectName("overwriteDialog");
// //msg->show();
// answer = msg->exec();
//}
//if (answer == QDialog::Rejected || answer == QMessageBox::No) {
// note: basename removes the whole file name from the first dot...
if (firstFilename.isEmpty() || !autoSaveNaming) {
QString savePath = (!selectedFilter.isEmpty()) ? saveFile.absoluteFilePath() : QFileInfo(saveFile.absoluteDir(), saveName).absoluteFilePath();
// TODO: set the main window here...
fileName = QFileDialog::getSaveFileName(dialogParent, tr("Save File %1").arg(saveName),
savePath, selectedFilter, &selectedFilter);
}
return fileName;
}
示例13: if
//.........这里部分代码省略.........
}
Exiv2::ExifData readedExif = exifMetadata();
for (Exiv2::ExifData::iterator it = readedExif.begin(); it != readedExif.end(); ++it)
{
if (!untouchedTags.contains(QString::fromLatin1(it->key().c_str())))
{
newExif[it->key().c_str()] = readedExif[it->key().c_str()];
}
}
image->setExifData(newExif);
}
else
{
image->setExifData(exifMetadata());
}
wroteEXIF = true;
}
qCDebug(DIGIKAM_METAENGINE_LOG) << "wroteEXIF: " << wroteEXIF;
// Iptc metadata ----------------------------------
mode = image->checkMode(Exiv2::mdIptc);
if ((mode == Exiv2::amWrite) || (mode == Exiv2::amReadWrite))
{
image->setIptcData(iptcMetadata());
wroteIPTC = true;
}
qCDebug(DIGIKAM_METAENGINE_LOG) << "wroteIPTC: " << wroteIPTC;
// Xmp metadata -----------------------------------
mode = image->checkMode(Exiv2::mdXmp);
if ((mode == Exiv2::amWrite) || (mode == Exiv2::amReadWrite))
{
#ifdef _XMP_SUPPORT_
image->setXmpData(xmpMetadata());
wroteXMP = true;
#endif
}
qCDebug(DIGIKAM_METAENGINE_LOG) << "wroteXMP: " << wroteXMP;
if (!wroteComment && !wroteEXIF && !wroteIPTC && !wroteXMP)
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "Writing metadata is not supported for file" << finfo.fileName();
return false;
}
else if (!wroteEXIF || !wroteIPTC || !wroteXMP)
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "Support for writing metadata is limited for file" << finfo.fileName();
}
if (!updateFileTimeStamp)
{
// Don't touch access and modification timestamp of file.
struct stat st;
struct utimbuf ut;
int ret = ::stat(QFile::encodeName(filePath).constData(), &st);
if (ret == 0)
{
ut.modtime = st.st_mtime;
ut.actime = st.st_atime;
}
image->writeMetadata();
if (ret == 0)
{
::utime(QFile::encodeName(filePath).constData(), &ut);
}
qCDebug(DIGIKAM_METAENGINE_LOG) << "File time stamp restored";
}
else
{
image->writeMetadata();
}
return true;
}
catch( Exiv2::Error& e )
{
printExiv2ExceptionError(QString::fromLatin1("Cannot save metadata using Exiv2 "), e);
}
catch(...)
{
qCCritical(DIGIKAM_METAENGINE_LOG) << "Default exception from Exiv2";
}
return false;
}
示例14: saveOperations
bool MetaEngine::Private::saveToFile(const QFileInfo& finfo) const
{
if (!finfo.isWritable())
{
qCDebug(DIGIKAM_METAENGINE_LOG) << "File" << finfo.fileName() << "is read only. Metadata not written.";
return false;
}
QStringList rawTiffBasedSupported, rawTiffBasedNotSupported;
// Raw files supported by Exiv2 0.21
rawTiffBasedSupported << QString::fromLatin1("dng")
<< QString::fromLatin1("nef")
<< QString::fromLatin1("pef")
<< QString::fromLatin1("orf")
<< QString::fromLatin1("srw");
if (Exiv2::testVersion(0,23,0))
{
rawTiffBasedSupported << QString::fromLatin1("cr2");
}
// Raw files not supported by Exiv2 0.21
rawTiffBasedNotSupported << QString::fromLatin1("3fr")
<< QString::fromLatin1("arw")
<< QString::fromLatin1("dcr")
<< QString::fromLatin1("erf")
<< QString::fromLatin1("k25")
<< QString::fromLatin1("kdc")
<< QString::fromLatin1("mos")
<< QString::fromLatin1("raw")
<< QString::fromLatin1("sr2")
<< QString::fromLatin1("srf")
<< QString::fromLatin1("rw2");
if (!Exiv2::testVersion(0,23,0))
{
rawTiffBasedNotSupported << QString::fromLatin1("cr2");
}
QString ext = finfo.suffix().toLower();
if (!writeRawFiles && (rawTiffBasedSupported.contains(ext) || rawTiffBasedNotSupported.contains(ext)) )
{
qCDebug(DIGIKAM_METAENGINE_LOG) << finfo.fileName()
<< "is a TIFF based RAW file, writing to such a file is disabled by current settings.";
return false;
}
/*
if (rawTiffBasedNotSupported.contains(ext))
{
qCDebug(DIGIKAM_METAENGINE_LOG) << finfo.fileName()
<< "is TIFF based RAW file not yet supported. Metadata not saved.";
return false;
}
if (rawTiffBasedSupported.contains(ext) && !writeRawFiles)
{
qCDebug(DIGIKAM_METAENGINE_LOG) << finfo.fileName()
<< "is TIFF based RAW file supported but writing mode is disabled. "
<< "Metadata not saved.";
return false;
}
qCDebug(DIGIKAM_METAENGINE_LOG) << "File Extension: " << ext << " is supported for writing mode";
bool ret = false;
*/
try
{
Exiv2::Image::AutoPtr image;
image = Exiv2::ImageFactory::open((const char*)(QFile::encodeName(finfo.filePath()).constData()));
return saveOperations(finfo, image);
}
catch( Exiv2::Error& e )
{
printExiv2ExceptionError(QString::fromLatin1("Cannot save metadata to image using Exiv2 "), e);
return false;
}
catch(...)
{
qCCritical(DIGIKAM_METAENGINE_LOG) << "Default exception from Exiv2";
return false;
}
}