本文整理汇总了C++中TFilePath::getWideString方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::getWideString方法的具体用法?C++ TFilePath::getWideString怎么用?C++ TFilePath::getWideString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePath
的用法示例。
在下文中一共展示了TFilePath::getWideString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeScreenSaver
void makeScreenSaver(
TFilePath scrFn,
TFilePath swfFn,
std::string screenSaverName)
{
struct _stat results;
if (_wstat(swfFn.getWideString().c_str(), &results) != 0)
throw TException(L"Can't stat file " + swfFn.getWideString());
int swfSize = results.st_size;
std::auto_ptr<char> swf(new char[swfSize]);
FILE *chan = _wfopen(swfFn.getWideString().c_str(), L"rb");
if (!chan)
throw TException(L"fopen failed on " + swfFn.getWideString());
fread(swf.get(), swfSize, 1, chan);
fclose(chan);
TFilePath svscrn = TSystem::getBinDir() + "screensaver.dat";
if (!TFileStatus(svscrn).doesExist()) {
throw TException(
std::wstring(L"Screensaver template not found: ") +
svscrn.getWideString());
}
TSystem::copyFile(scrFn, svscrn);
HANDLE hUpdateRes =
BeginUpdateResourceW(scrFn.getWideString().c_str(), FALSE);
if (hUpdateRes == NULL)
throw TException(L"can't write " + scrFn.getWideString());
BOOL result = UpdateResource(
hUpdateRes,
"FLASHFILE",
MAKEINTRESOURCE(101),
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
swf.get(),
swfSize);
if (result == FALSE)
throw TException(L"can't add resource to " + scrFn.getWideString());
/*
result = UpdateResource(
hUpdateRes,
RT_STRING,
MAKEINTRESOURCE(1),
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
(void*)screenSaverName.c_str(),
screenSaverName.size());
if (result == FALSE)
throw TException(L"can't add name to "+scrFn.getWideString());
*/
if (!EndUpdateResource(hUpdateRes, FALSE))
throw TException(L"Couldn't write " + scrFn.getWideString());
}
示例2: refreshChildren
void ProjectDvDirModelRootNode::refreshChildren() {
m_childrenValid = true;
if (m_children.empty()) {
TProjectManager *pm = TProjectManager::instance();
std::vector<TFilePath> projectRoots;
pm->getProjectRoots(projectRoots);
int i;
for (i = 0; i < (int)projectRoots.size(); i++) {
TFilePath projectRoot = projectRoots[i];
std::wstring rootDir = projectRoot.getWideString();
ProjectDvDirModelSpecialFileFolderNode *projectRootNode =
new ProjectDvDirModelSpecialFileFolderNode(
this, L"Project root (" + rootDir + L")", projectRoot);
projectRootNode->setPixmap(svgToPixmap(":Resources/projects.svg"));
addChild(projectRootNode);
}
// SVN Repository
QList<SVNRepository> repositories =
VersionControl::instance()->getRepositories();
int count = repositories.size();
for (int i = 0; i < count; i++) {
SVNRepository repo = repositories.at(i);
ProjectDvDirModelSpecialFileFolderNode *node =
new ProjectDvDirModelSpecialFileFolderNode(
this, repo.m_name.toStdWString(),
TFilePath(repo.m_localPath.toStdWString()));
node->setPixmap(svgToPixmap(":Resources/vcroot.svg"));
addChild(node);
}
}
}
示例3: showDocument
bool TSystem::showDocument(const TFilePath &path) {
#ifdef _WIN32
int ret = (int)ShellExecuteW(0, L"open", path.getWideString().c_str(), 0, 0,
SW_SHOWNORMAL);
if (ret <= 32) {
return false;
throw TSystemException(path, "Can't open");
}
return true;
#else
string cmd = "open ";
string thePath(::to_string(path));
UINT pos = 0, count = 0;
// string newPath;
char newPath[2048];
while (pos < thePath.size()) {
char c = thePath[pos];
if (c == ' ') newPath[count++] = '\\';
newPath[count++] = c;
++pos;
}
newPath[count] = 0;
cmd = cmd + string(newPath);
system(cmd.c_str());
return true;
#endif
}
示例4: stream
TLevelReaderMov::TLevelReaderMov(const TFilePath &path) : TLevelReader(path) {
static TAtomicVar count;
unsigned int currCount = ++count;
m_id = currCount;
QLocalSocket socket;
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1,
t32bitsrv::srvCmdline());
tipc::Stream stream(&socket);
tipc::Message msg;
stream << (msg << QString("$initLRMov") << m_id
<< QString::fromStdWString(path.getWideString()));
if (tipc::readMessage(stream, msg) != "ok")
throw TImageException(path, "Couldn't open file");
double frameRate;
msg >> m_lx >> m_ly >> frameRate >> tipc::clr;
m_info = new TImageInfo;
m_info->m_lx = m_lx;
m_info->m_ly = m_ly;
m_info->m_frameRate = frameRate;
}
示例5: execute
bool execute()
{
TFilePath fp;
QString fileName = "helloworld.qs";
QFile scriptFile(QString::fromStdWString(fp.getWideString()));
if (!scriptFile.open(QIODevice::ReadOnly)) {
DVGui::MsgBox(DVGui::WARNING, QObject::tr("File not found"));
return false;
} else {
QTextStream stream(&scriptFile);
QString contents = stream.readAll();
scriptFile.close();
QScriptEngine myEngine;
QScriptEngineDebugger debugger;
debugger.attachTo(&myEngine);
QScriptValue fFoo = myEngine.newFunction(foo);
QScriptValue fGetLevel = myEngine.newFunction(getLevel);
myEngine.globalObject().setProperty("foo", fFoo);
myEngine.globalObject().setProperty("getLevel", fGetLevel);
debugger.action(QScriptEngineDebugger::InterruptAction)->trigger();
myEngine.evaluate(contents, fileName);
}
return true;
}
示例6: showEvent
void MagpieFileImportPopup::showEvent(QShowEvent *)
{
if (m_info == 0)
return;
int frameCount = m_info->getFrameCount();
m_fromField->setRange(1, frameCount);
m_fromField->setValue(1);
m_toField->setRange(1, frameCount);
m_toField->setValue(frameCount);
int i;
QList<QString> actsIdentifier = m_info->getActsIdentifier();
for (i = 0; i < m_actFields.size(); i++) {
IntLineEdit *field = m_actFields.at(i).second;
QLabel *label = m_actFields.at(i).first;
if (i >= actsIdentifier.size()) {
field->hide();
label->hide();
continue;
}
QString act = actsIdentifier.at(i);
field->setProperty("act", QVariant(act));
field->show();
label->setText(act);
label->show();
}
QString oldLevelPath = m_levelField->getPath();
TFilePath oldFilePath(oldLevelPath.toStdWString());
TFilePath perntDir = oldFilePath.getParentDir();
m_levelField->setPath(QString::fromStdWString(perntDir.getWideString()));
}
示例7: loadControllerData
void loadControllerData(const TFilePath &fp, ControllerData &data)
{
Tifstream is(fp);
if (!is || !is.good()) {
throw TException(
L"Unable to get Farm Controller Data (looking for '" + fp.getWideString() + L"')");
}
while (!is.eof()) {
char line[1024];
is.getline(line, 1024);
if (line[0] != '#' && QString(line) != "") {
std::istrstream iss(line);
char hostName[512];
char ipAddr[80];
int port;
iss >> hostName >> ipAddr >> port;
data.m_hostName = hostName;
data.m_ipAddress = ipAddr;
data.m_port = port;
break;
}
}
示例8: refresh
void refresh() override {
TDoubleKeyframe kf;
TDoubleParam *curve = getCurve();
if (curve) kf = curve->getKeyframeAt(getR0());
if (curve && kf.m_isKeyframe) {
TFilePath path;
int fieldIndex = 0;
std::string unitName = "";
if (kf.m_type == TDoubleKeyframe::File) {
path = kf.m_fileParams.m_path;
fieldIndex = kf.m_fileParams.m_fieldIndex;
if (fieldIndex < 0) fieldIndex = 0;
unitName = kf.m_unitName;
if (unitName == "") {
TMeasure *measure = curve->getMeasure();
if (measure) {
const TUnit *unit = measure->getCurrentUnit();
if (unit) unitName = ::to_string(unit->getDefaultExtension());
}
}
}
m_fileFld->setPath(QString::fromStdWString(path.getWideString()));
m_fieldIndexFld->setText(QString::number(fieldIndex + 1));
m_measureFld->setText(QString::fromStdString(unitName));
}
}
示例9: doRender
void RenderCommand::doRender(bool isPreview)
{
bool isWritable = true;
bool isMultiFrame;
/*-- 初期化処理。フレーム範囲の計算や、Renderの場合はOutputSettingsから保存先パスも作る --*/
if (!init(isPreview))
return;
if (m_fp.getDots() == ".") {
isMultiFrame = false;
TFileStatus fs(m_fp);
if (fs.doesExist())
isWritable = fs.isWritable();
} else {
isMultiFrame = true;
TFilePath dir = m_fp.getParentDir();
QDir qDir(QString::fromStdWString(dir.getWideString()));
QString levelName = QRegExp::escape(QString::fromStdWString(m_fp.getWideName()));
QString levelType = QString::fromStdString(m_fp.getType());
QString exp(levelName + ".[0-9]{1,4}." + levelType);
QRegExp regExp(exp);
QStringList list = qDir.entryList(QDir::Files);
QStringList livelFrames = list.filter(regExp);
int i;
for (i = 0; i < livelFrames.size() && isWritable; i++) {
TFilePath frame = dir + TFilePath(livelFrames[i].toStdWString());
if (frame.isEmpty() || !frame.isAbsolute())
continue;
TFileStatus fs(frame);
isWritable = fs.isWritable();
}
}
if (!isWritable) {
string str = "It is not possible to write the output: the file";
str += isMultiFrame ? "s are read only." : " is read only.";
MsgBox(WARNING, QString::fromStdString(str));
return;
}
ToonzScene *scene = 0;
TCamera *camera = 0;
try {
/*-- Xsheetノードに繋がっている各ラインごとに計算するモード。
MultipleRender で Schematic Flows または Fx Schematic Terminal Nodes が選択されている場合
--*/
if (m_multimediaRender && m_fp.getType() != "swf") //swf is not currently supported on multimedia...
multimediaRender();
else if (!isPreview && m_fp.getType() == "swf")
flashRender();
else
/*-- 通常のRendering --*/
rasterRender(isPreview);
} catch (TException &e) {
MsgBox(WARNING, QString::fromStdString(toString(e.getMessage())));
} catch (...) {
MsgBox(WARNING, QObject::tr("It is not possible to complete the rendering."));
}
}
示例10: relToDir
inline static TFilePath getRelativePath(const TFilePath &file,
const TFilePath &relTo) {
QDir relToDir(
QString::fromStdWString(relTo.getParentDir().getWideString()));
QString relFileStr(relToDir.relativeFilePath(
QString::fromStdWString(file.getWideString())));
return TFilePath(relFileStr.toStdWString());
}
示例11: installScreenSaver
void installScreenSaver(TFilePath scr)
{
std::wstring cmd = L"desk.cpl,InstallScreenSaver " + scr.getWideString();
int ret = (int)
ShellExecuteW(0, L"open", L"rundll32.exe", cmd.c_str(), 0, SW_SHOWNORMAL);
if (ret <= 32)
throw;
}
示例12: onItemChanged
void CastTreeViewer::onItemChanged(QTreeWidgetItem *item, int column) {
if (column != 0) return;
if (item->isSelected()) {
TFilePath oldPath(item->data(1, Qt::DisplayRole).toString().toStdWString());
TFilePath newPath =
getLevelSet()->renameFolder(oldPath, item->text(0).toStdWString());
item->setText(1, QString::fromStdWString(newPath.getWideString()));
}
}
示例13: ifstream
Tifstream::Tifstream(const TFilePath &fp)
: ifstream(QString::fromStdWString(fp.getWideString()).toUtf8().data(), ios::binary)
/*: ifstream(openFileForReading(fp), ios::binary)
NO! Questo costruttore non e' standard, anche se e' presente
in molte versioni. Nel MAC non c'e e fa un cast a char*
sperando che sia il nome del file => compila ma non funziona
*/
{
}
示例14: hideFile
void TSystem::hideFile(const TFilePath &fp) {
#ifdef _WIN32
if (!SetFileAttributesW(fp.getWideString().c_str(), FILE_ATTRIBUTE_HIDDEN))
throw TSystemException(fp, "can't hide file!");
#else // MACOSX, and others
TSystem::renameFile(TFilePath(fp.getParentDir() + L"." + fp.getLevelNameW()),
fp);
#endif
}
示例15: loadMacro
void AddFxContextMenu::loadMacro() {
TFilePath macroDir = m_presetPath + TFilePath("macroFx");
try {
if (TFileStatus(macroDir).isDirectory()) {
TFilePathSet macros = TSystem::readDirectory(macroDir);
if (macros.empty()) return;
QMenu *insertMacroMenu = new QMenu("Macro", m_insertMenu);
QMenu *addMacroMenu = new QMenu("Macro", m_addMenu);
QMenu *replaceMacroMenu = new QMenu("Macro", m_replaceMenu);
m_insertMenu->addMenu(insertMacroMenu);
m_addMenu->addMenu(addMacroMenu);
m_replaceMenu->addMenu(replaceMacroMenu);
for (TFilePathSet::iterator it = macros.begin(); it != macros.end();
++it) {
TFilePath macroPath = *it;
QString name = QString::fromStdWString(macroPath.getWideName());
QAction *insertAction = new QAction(name, insertMacroMenu);
QAction *addAction = new QAction(name, addMacroMenu);
QAction *replaceAction = new QAction(name, replaceMacroMenu);
insertAction->setData(
QVariant(QString::fromStdWString(macroPath.getWideString())));
addAction->setData(
QVariant(QString::fromStdWString(macroPath.getWideString())));
replaceAction->setData(
QVariant(QString::fromStdWString(macroPath.getWideString())));
insertMacroMenu->addAction(insertAction);
addMacroMenu->addAction(addAction);
replaceMacroMenu->addAction(replaceAction);
m_insertActionGroup->addAction(insertAction);
m_addActionGroup->addAction(addAction);
m_replaceActionGroup->addAction(replaceAction);
}
}
} catch (...) {
}
}