本文整理汇总了C++中Notebook::dirPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Notebook::dirPath方法的具体用法?C++ Notebook::dirPath怎么用?C++ Notebook::dirPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notebook
的用法示例。
在下文中一共展示了Notebook::dirPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
CrashReport cr;
Notebook *nb = 0;
App app(argc, argv);
try {
app.setWindowIcon(QIcon(":/eln.png"));
Fonts fonts;
if (argc>1 && QString("-novc")==argv[1]) {
VersionControl::globallyDisable();
argc--;
argv++;
}
if (argc>1 && QString("-nocui")==argv[1]) {
CUI::globallyDisable();
argc--;
argv++;
}
if (argc==1) {
nb = SplashScene::openNotebook();
if (!nb)
return 0;
} else if (argc==2 && argv[1][0]!='-') {
QString fn = QDir::fromNativeSeparators(argv[1]);
if (fn.endsWith("/book.eln"))
fn = fn.left(fn.length() - 9);
if (AlreadyOpen::check(fn))
return 0;
nb = Notebook::open(fn);
if (!nb) {
QMessageBox::critical(0, Translate::_("eln"),
Translate::_("could-not-open-notebook").arg(fn)
+ "\n" + Notebook::errorMessage(),
QMessageBox::Close);
return 1;
}
} else if (argc==3 && argv[1]==QString("-new")) {
QString fn = argv[2];
if (QDir(fn).exists()) {
QMessageBox::critical(0, Translate::_("eln"),
Translate::_("could-not-create-notebook-exists")
.arg(fn),
QMessageBox::Abort);
return 1;
}
nb = Notebook::create(fn) ? Notebook::open(fn) : 0;
if (!nb) {
QMessageBox::critical(0, Translate::_("eln"),
Translate::_("could-not-create-notebook")
.arg(fn)
+ "\n" + Notebook::errorMessage(),
QMessageBox::Abort);
return 1;
}
} else {
qDebug() << Translate::_("usage");
return 1;
}
ASSERT(nb);
assertion_register_notebook(nb);
int r = 0;
AppInstance *inst = 0;
try {
inst = new AppInstance(&app, nb);
} catch (QString s) {
QMessageBox::critical(0, Translate::_("eln"),
Translate::_("could-not-open-notebook")
.arg(nb->dirPath())
+ "\n" + Notebook::errorMessage(),
QMessageBox::Close);
}
r = app.exec();
delete inst;
delete RecentBooks::instance();
return r;
} catch (AssertedException) {
return 1;
}
}