本文整理汇总了C++中setFileName函数的典型用法代码示例。如果您正苦于以下问题:C++ setFileName函数的具体用法?C++ setFileName怎么用?C++ setFileName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFileName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEditable
void
MetadataEditor::loadResult( const Tomahawk::result_ptr& result )
{
if ( result.isNull() )
return;
m_result = result;
setEditable( result->collection() && result->collection()->source()->isLocal() );
setTitle( result->track()->track() );
setArtist( result->track()->artist() );
setAlbum( result->track()->album() );
setAlbumPos( result->track()->albumpos() );
setDuration( result->track()->duration() );
setYear( result->track()->year() );
setBitrate( result->bitrate() );
if ( result->collection() && result->collection()->source()->isLocal() )
{
QString furl = m_result->url();
if ( furl.startsWith( "file://" ) )
furl = furl.right( furl.length() - 7 );
QFileInfo fi( furl );
setFileName( fi.absoluteFilePath() );
setFileSize( TomahawkUtils::filesizeToString( fi.size() ) );
}
setWindowTitle( result->track()->track() );
if ( m_interface )
{
m_index = m_interface->indexOfResult( result );
if ( m_index >= 0 )
enablePushButtons();
}
}
示例2: hxfile
DisAssembler::DisAssembler()
{
bankselhelp = 0;
ifstream hxfile(setFileName() + ".HEX");
int count = 0;
string linetest;
for (int i = 0; i < 128; ++i)
{
program[i] = "\0";
}
for (int i = 0; i < 16; ++i)
{
hx[i] = intStrConv(i);
}
while (getline(hxfile, line))
{
parseLine(count);
++count;
}
hxfile.close();
displayProgram();
}
示例3: replaceTags
void EditorState::load()
{
if (EditorWidgets::getInstance().load(mFileName))
{
if (mFileName != mDefaultFileName && !isProjectFile(mFileName))
RecentFilesManager::getInstance().addRecentFile(mFileName);
UndoManager::getInstance().addValue();
UndoManager::getInstance().setUnsaved(false);
}
else
{
/*MyGUI::Message* message = */MessageBoxManager::getInstance().create(
replaceTags("Error"),
replaceTags("MessageFailedLoadFile"),
MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok
);
setFileName(mDefaultFileName);
updateCaption();
}
}
示例4: loadResult
void
MetadataEditor::loadQuery( const Tomahawk::query_ptr& query )
{
if ( query.isNull() )
return;
if ( query->numResults() )
{
loadResult( query->results().first() );
return;
}
m_result = Tomahawk::result_ptr();
m_query = query;
setEditable( false );
setTitle( query->track()->track() );
setArtist( query->track()->artist() );
setAlbum( query->track()->album() );
setAlbumPos( query->track()->albumpos() );
setDuration( query->track()->duration() );
setYear( 0 );
setBitrate( 0 );
setFileName( QString() );
setFileSize( 0 );
setWindowTitle( query->track()->track() );
if ( m_interface )
{
m_index = m_interface->indexOfQuery( query );
if ( m_index >= 0 )
enablePushButtons();
}
}
示例5: qDebug
void CDoodFileViewManager::showFilePage(QString id, QString fileName, QString url, QString encryptKey, long long size, QString encryptUser)
{
qDebug()<<Q_FUNC_INFO;
QString path("");
QFileInfo file;
if(url != ""){//send
path = QString::fromStdString(APP_SAVE_FILE_APTH)+"/"+fileName;
}else{
path = fileName;
}
file.setFile(path);
setFileName(file.fileName());
mId = id;
mUrl = url;
mEncryptKey = encryptKey;
if(encryptUser != ""){
mEncryptUser = encryptUser;
}
if(size != 0){
setSize(size);
}
if(file.exists()){
setPath(path);
setProggress(100);
setStatus(3);
setSize(file.size());
}else{
setPath("");
setProggress(0);
setStatus(1);
}
}
示例6: switch
int QPluginLoader::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = fileName(); break;
case 1: *reinterpret_cast< QLibrary::LoadHints*>(_v) = loadHints(); break;
}
_id -= 2;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setFileName(*reinterpret_cast< QString*>(_v)); break;
case 1: setLoadHints(*reinterpret_cast< QLibrary::LoadHints*>(_v)); break;
}
_id -= 2;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 2;
}
#endif // QT_NO_PROPERTIES
return _id;
}
示例7: tr
bool ParameterFileModel::load(const QString& fName) {
// determine which file to load
// (file dialog if fName is empty)
QString fromDialog = fName;
if (fromDialog.isEmpty()) {
QString guess = _fileName;
if (guess.isEmpty()) {
QSettings settings;
QStringList files =
settings.value("recentFileList").toStringList();
if (files.size() > 0)
guess = files[0];
else
guess = QDir::homePath();
}
fromDialog = QFileDialog::getOpenFileName(0, tr("Open File"),
guess, tr("ParameterFiles (*.wrp);;All Files (*.*)"));
}
if (fromDialog.isEmpty()) {
emit statusMessage(tr("no file selected"));
}
else if (!QFileInfo(fromDialog).isFile()) {
QMessageBox::warning(0, tr("Error loading file"),
tr("File <em>%1</em> does not exist or is no file!")
.arg(fromDialog));
}
else if (!QFileInfo(fromDialog).isReadable()) {
QMessageBox::warning(0, tr("Error loading file"),
tr("File <em>%1</em> is not readable!").arg(fromDialog));
}
else {
// fromDialog is a readable file now
setFileName(fromDialog);
return _load();
}
return false;
}
示例8: QMainWindow
FritzingWindow::FritzingWindow(const QString &untitledFileName, int &untitledFileCount, QString fileExt, QWidget * parent, Qt::WFlags f)
: QMainWindow(parent, f)
{
___fritzingTitle___ = QObject::tr("Fritzing");
m_readOnly = false;
// Let's set the icon
this->setWindowIcon(QIcon(QPixmap(":resources/images/fritzing_icon.png")));
QString fn = untitledFileName;
if(untitledFileCount > 1) {
fn += " " + QString::number(untitledFileCount);
}
fn += fileExt;
setFileName(fn);
untitledFileCount++;
setTitle();
m_undoStack = new WaitPushUndoStack(this);
connect(m_undoStack, SIGNAL(cleanChanged(bool)), this, SLOT(undoStackCleanChanged(bool)) );
}
示例9: loadString
Magic3D::XMLElement* Magic3D::Model::load(XMLElement* root)
{
if (root)
{
XMLElement* model = root->FirstChildElement(M3D_MODEL_XML);
std::string name = loadString(model, M3D_MODEL_XML_FILE);
if (name.compare(M3D_XML_NULL) != 0)
{
setFileName(name);
}
if (getSkeleton())
{
getSkeleton()->load(model);
}
}
Object::load(root);
updateBoundingBox();
return root;
}
示例10: clearDocument
bool App::loadWorkspace(const QString &fileName)
{
/* Clear existing document data */
clearDocument();
m_docLoaded = false;
emit docLoadedChanged();
QString localFilename = fileName;
if (localFilename.startsWith("file:"))
localFilename = QUrl(fileName).toLocalFile();
if (loadXML(localFilename) == QFile::NoError)
{
setTitle(QString("Q Light Controller Plus - %1").arg(localFilename));
setFileName(localFilename);
m_docLoaded = true;
updateRecentFilesList(localFilename);
emit docLoadedChanged();
m_contextManager->resetContexts();
m_doc->resetModified();
return true;
}
return false;
}
示例11: pout
std::ostream& pout()
{
#ifdef CH_MPI
// the common case is _open == true, which just returns s_pout
if ( ! s_pout_open )
{
// the uncommon cae: the file isn't opened, MPI may not be
// initialized, and the basename may not have been set
int flag_i, flag_f;
MPI_Initialized(&flag_i);
MPI_Finalized(&flag_f);
// app hasn't set a basename yet, so set the default
if ( ! s_pout_init )
{
s_pout_basename = "pout" ;
s_pout_init = true ;
}
// if MPI not initialized, we cant open the file so return cout
if ( ! flag_i || flag_f)
{
return std::cout; // MPI hasn't been started yet, or has ended....
}
// MPI is initialized, so file must not be, so open it
setFileName() ;
openFile() ;
// finally, in case the open failed, return cout
if ( ! s_pout_open )
{
return std::cout ;
}
}
return s_pout ;
#else
return std::cout;
#endif
}
示例12: ShapeAnnotation
/*!
* \brief BitmapAnnotation::BitmapAnnotation
* Used by OMSimulator FMU ModelWidget\n
* We always make this shape as inherited shape since its not allowed to be modified.
* \param classFileName
* \param pGraphicsView
*/
BitmapAnnotation::BitmapAnnotation(QString classFileName, GraphicsView *pGraphicsView)
: ShapeAnnotation(true, pGraphicsView, 0)
{
mpComponent = 0;
mClassFileName = classFileName;
// set the default values
GraphicItem::setDefaults();
ShapeAnnotation::setDefaults();
// set users default value by reading the settings file.
ShapeAnnotation::setUserDefaults();
QList<QPointF> extents;
extents << QPointF(-100, -100) << QPointF(100, 100);
setExtents(extents);
setPos(mOrigin);
setRotation(mRotation);
setShapeFlags(true);
setFileName(mClassFileName);
if (!mFileName.isEmpty() && QFile::exists(mFileName)) {
mImage.load(mFileName);
} else {
mImage = QImage(":/Resources/icons/bitmap-shape.svg");
}
}
示例13: _pManager
Buffer::Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName) // type must be either DOC_REGULAR or DOC_UNNAMED
: _pManager(pManager), _id(id), _isDirty(false), _doc(doc), _isFileReadOnly(false), _isUserReadOnly(false), _recentTag(-1), _references(0),
_canNotify(false), _timeStamp(0), _needReloading(false), _encoding(-1)
{
NppParameters *pNppParamInst = NppParameters::getInstance();
const NewDocDefaultSettings & ndds = (pNppParamInst->getNppGUI()).getNewDocDefaultSettings();
_format = ndds._format;
_unicodeMode = ndds._encoding;
_encoding = ndds._codepage;
if (_encoding != -1)
_unicodeMode = uniCookie;
_userLangExt = TEXT("");
_fullPathName = TEXT("");
_fileName = NULL;
setFileName(fileName, ndds._lang);
updateTimeStamp();
checkFileState();
_currentStatus = type;
_isDirty = false;
_needLexer = false; //new buffers do not need lexing, Scintilla takes care of that
_canNotify = true;
}
示例14: setFileName
int
MidiFile::read(const char *fileName) {
if (fileName == NULL)
return 1;
setFileName(fileName);
_target = openFile(fileName);
if (!_target)
return 1;
readFileHeader();
setType();
setTrackCount();
setBPM();
for (int i = 0; i < _fileHeader._tracks; i++) {
_curTrack = i;
readTrack();
printContour();
}
fclose(_target);
return 0;
}
示例15: setFileName
DCIFile::DCIFile(char *fn) {
setFileName(fn);
}