//! [9]
bool MainWindow::save()
-//! [9] //! [10]
{
- if (curContent.isEmpty()) {
- return saveAs();
- } else {
- return saveContent(curContent);
- }
+ return saveContent();
}
-//! [10]
-//! [11]
bool MainWindow::saveAs()
-//! [11] //! [12]
{
- QString dirName = QFileDialog::getSaveFileName(this);
- if (dirName.isEmpty())
- return false;
-
- return saveContent(dirName);
+ //TODO
+ return false;
}
-//! [12]
-//! [13]
void MainWindow::about()
-//! [13] //! [14]
{
QMessageBox::about(this, tr("About Application"),
tr("TODO: exampalin\81@about <b>dennco creator</b> "
"TODO: exampalin\81@about <b>dennco creator</b> "
"TODO: exampalin\81@about <b>dennco creator</b>"));
}
-//! [14]
-//! [15]
void MainWindow::documentWasModified()
//! [15] //! [16]
{
//! [42]
void MainWindow::loadContent(const QString &contentDirectory)
-//! [42] //! [43]
{
-
if (!mCreator)
return;
- //TODO
- QByteArray aContentDirectory = contentDirectory.toLocal8Bit();
- mCreator->loadContent(aContentDirectory.data());
+ mCreator->loadContent(contentDirectory);
setCurrentContent(contentDirectory);
statusBar()->showMessage(tr("Content loaded"), 2000);
}
-//! [43]
-//! [44]
-bool MainWindow::saveContent(const QString &contentDirectory)
+bool MainWindow::saveContent()
{
+ if (!mCreator)
+ return false;
- //TODO
+ if (mCreator->getCurrentContainer())
+ {
+ mCreator->saveAll();
+ statusBar()->showMessage(tr("Content saved"), 2000);
+ }
- setCurrentContent(contentDirectory);
- statusBar()->showMessage(tr("Content saved"), 2000);
return true;
}
-//! [45]
-//! [46]
void MainWindow::setCurrentContent(const QString &contentDirectory)
{
curContent = contentDirectory;