本文整理汇总了C++中IApplication::fileManager方法的典型用法代码示例。如果您正苦于以下问题:C++ IApplication::fileManager方法的具体用法?C++ IApplication::fileManager怎么用?C++ IApplication::fileManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplication
的用法示例。
在下文中一共展示了IApplication::fileManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
#endif
{
#ifndef LITEAPP_LIBRARY
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
#endif
#endif
QApplication app(argc, argv);
#if QT_VERSION >= 0x050100
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
//QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
QTranslator translator;
QTranslator qtTranslator;
QString resPath = LiteApp::getResoucePath();
QString locale = QLocale::system().name();
QString qss;
QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
if (storeLocal) {
const QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
} else {
const QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
}
if (!locale.isEmpty()) {
const QString &liteideTrPath = resPath+"/translations";
if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
// Binary installer puts Qt tr files into creatorTrPath
app.installTranslator(&translator);
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
app.installTranslator(&qtTranslator);
}
app.setProperty("liteide_locale", locale);
}
}
if (!qss.isEmpty()) {
QFile f(resPath+"/liteapp/qss/"+qss);
if (f.open(QFile::ReadOnly)) {
QString styleSheet = QLatin1String(f.readAll());
app.setStyleSheet(styleSheet);
}
}
QDir::addSearchPath("icon",resPath);
QDir::addSearchPath("icon",resPath+"/liteapp");
QDir::addSearchPath("icon",":/");
#if QT_VERSION >= 0x050000
QString storage = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#else
QString storage = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
QDir dir(storage);
dir.mkdir("liteide");
QStringList argList;
QStringList fileList;
if (argc >= 2) {
for (int i = 1; i < argc; i++) {
QString arg = argv[i];
if (arg.startsWith("-")) {
argList.append(arg);
continue;
} else {
fileList.append(arg);
}
}
}
IApplication *liteApp = LiteApp::NewApplication(true,0);
if (fileList.size() == 1) {
QString file = fileList.at(0);
QFileInfo f(file);
if (f.isFile()) {
liteApp->fileManager()->addFolderList(f.path());
liteApp->fileManager()->openEditor(file);
} else if (f.isDir()) {
liteApp->fileManager()->addFolderList(file);
}
} else {
foreach(QString file, fileList) {
QFileInfo f(file);
if (f.isFile()) {
liteApp->fileManager()->openEditor(file);
} else if (f.isDir()) {
liteApp->fileManager()->addFolderList(file);
}
}
}
示例2: main
//.........这里部分代码省略.........
for(int i = 1; i < arguments.size(); i++) {
QString arg = arguments[i];
if (arg.startsWith("-")) {
if (arg.indexOf(flagSelectEnv+"=") == 0) {
argSelectEnv = arg.mid(flagSelectEnv.length()+1);
} else if (arg == flagSelectEnv) {
i++;
if (i < arguments.size()) {
argSelectEnv = arguments[i];
}
} else if (arg == flagResetSetting) {
argResetSetting = true;
} else if (arg == flagLocalSetting) {
argLocalSetting = true;
} else if (arg == flagUserSetting) {
argUserSetting = true;
}
continue;
}
fileList.append(arg);
}
//save to global
if (!argSelectEnv.isEmpty()) {
LiteApp::s_cookie.insert(flagSelectEnv,argSelectEnv);
}
if (argLocalSetting) {
LiteApp::s_cookie.insert(flagLocalSetting,true);
}
if (argUserSetting) {
LiteApp::s_cookie.insert(flagUserSetting,true);
}
#if QT_VERSION >= 0x050100
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
//QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
QTranslator translator;
QTranslator qtTranslator;
QString resPath = LiteApp::getResoucePath();
QString locale = QLocale::system().name();
QString qss;
QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
if (argUserSetting) {
storeLocal = false;
} else if (argLocalSetting) {
storeLocal = true;
}
if (storeLocal) {
QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
if (argResetSetting) {
settings.clear();
}
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
} else {
QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
if (argResetSetting) {
settings.clear();
}
locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
qss = settings.value(LITEAPP_QSS,"default.qss").toString();
}
if (!locale.isEmpty()) {
const QString &liteideTrPath = resPath+"/translations";
if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + locale;
// Binary installer puts Qt tr files into creatorTrPath
app.installTranslator(&translator);
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
app.installTranslator(&qtTranslator);
}
app.setProperty("liteide_locale", locale);
}
}
if (!qss.isEmpty()) {
QFile f(resPath+"/liteapp/qss/"+qss);
if (f.open(QFile::ReadOnly)) {
QString styleSheet = QLatin1String(f.readAll());
app.setStyleSheet(styleSheet);
}
}
IApplication *liteApp = LiteApp::NewApplication("default",0);
foreach(QString file, fileList) {
QFileInfo f(file);
if (f.isFile()) {
liteApp->fileManager()->openEditor(file);
} else if (f.isDir()) {
liteApp->fileManager()->addFolderList(file);
}
}