Added setReadOnly() methods to the title block template editor classes.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1473 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-01-22 14:35:57 +00:00
parent 0e0e4dfc29
commit 21c8ffbd7b
10 changed files with 152 additions and 10 deletions

View File

@@ -32,8 +32,8 @@
*/
QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor(QWidget *parent) :
QMainWindow(parent),
read_only(false),
opened_from_file_(false),
read_only_(false),
tb_template_(0),
logo_manager_(0)
{
@@ -394,6 +394,7 @@ void QETTitleBlockTemplateEditor::initWidgets() {
*/
void QETTitleBlockTemplateEditor::initLogoManager() {
logo_manager_ = new TitleBlockTemplateLogoManager(tb_template_);
logo_manager_ -> setReadOnly(read_only_);
connect(
logo_manager_,
SIGNAL(logosChanged(const TitleBlockTemplate *)),
@@ -420,6 +421,9 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const {
if (!undo_stack_ -> isClean()) {
tag = tr("[Modifi\351]", "window title tag");
}
if (read_only_) {
tag = tr("[Lecture seule]", "window title tag");
}
titleblock_title = QString(
tr(
"%1 %2",
@@ -499,6 +503,16 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() {
setWindowTitle(title);
}
/**
Ensure the user interface remains consistent by enabling or disabling
adequate actions.
*/
void QETTitleBlockTemplateEditor::updateActions() {
/// TODO complete this method
merge_cells_ -> setEnabled(!read_only_);
split_cell_ -> setEnabled(!read_only_);
}
/**
Save the template under the provided location.
@see QETProject::setTemplateXmlDescription()
@@ -644,6 +658,22 @@ bool QETTitleBlockTemplateEditor::saveAsFile() {
return(saving);
}
/**
@param read_only True to restrict this editor to visualization of the
currently edited template, false to allow full edition.
*/
void QETTitleBlockTemplateEditor::setReadOnly(bool read_only) {
if (read_only == read_only_) return;
read_only_ = read_only;
if (logo_manager_) {
logo_manager_ -> setReadOnly(read_only_);
}
template_cell_editor_widget_ -> setReadOnly(read_only_);
template_edition_area_view_ -> setReadOnly(read_only_);
updateActions();
updateEditorTitle();
}
/**
Ask the user for a title block template location
@param title Title displayed by the dialog window