forked from len0rd/rockbox
Theme Editor: Got document title change signal working, beginning work on save function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26567 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d41a681053
commit
4051b34039
4 changed files with 53 additions and 0 deletions
|
|
@ -21,12 +21,18 @@
|
|||
|
||||
#include "skindocument.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
#include <QSettings>
|
||||
|
||||
SkinDocument::SkinDocument(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
setupUI();
|
||||
|
||||
title = "Untitled";
|
||||
fileName = "";
|
||||
saved = true;
|
||||
}
|
||||
|
||||
SkinDocument::~SkinDocument()
|
||||
|
|
@ -65,4 +71,33 @@ void SkinDocument::setupUI()
|
|||
void SkinDocument::codeChanged()
|
||||
{
|
||||
model->changeTree(editor->document()->toPlainText().toAscii());
|
||||
if(saved == true)
|
||||
{
|
||||
saved = false;
|
||||
title.append(tr("*"));
|
||||
emit titleChanged(title);
|
||||
}
|
||||
}
|
||||
|
||||
void SkinDocument::save()
|
||||
{
|
||||
QFile fout(fileName);
|
||||
|
||||
if(!fout.exists())
|
||||
{
|
||||
QTimer::singleShot(0, this, SLOT(saveAs()));
|
||||
return;
|
||||
}
|
||||
|
||||
fout.open(QFile::WriteOnly);
|
||||
fout.write(editor->document()->toPlainText().toAscii());
|
||||
fout.close();
|
||||
|
||||
saved = true;
|
||||
}
|
||||
|
||||
void SkinDocument::saveAs()
|
||||
{
|
||||
/* Determining the directory to open */
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue