From 853d169549a1d62ac7ae8fc4affce02d9e082432 Mon Sep 17 00:00:00 2001 From: xavier Date: Fri, 30 Dec 2011 02:42:50 +0000 Subject: [PATCH] Title block template editor: the logos combo box is now updated after every change made from the logo manager. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1419 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/titleblock/qettemplateeditor.cpp | 13 +++++++++++-- sources/titleblock/qettemplateeditor.h | 1 + sources/titleblock/templatelogomanager.cpp | 12 +++++++++++- sources/titleblock/templatelogomanager.h | 5 +++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 9561b87da..d78b7b800 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -98,10 +98,9 @@ bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &templ void QETTitleBlockTemplateEditor::editLogos() { if (tb_template_) { if (!logo_manager_) { - logo_manager_ = new TitleBlockTemplateLogoManager(tb_template_); + initLogoManager(); } logo_manager_ -> show(); - template_cell_editor_widget_ -> updateLogosComboBox(tb_template_); } } @@ -243,6 +242,16 @@ void QETTitleBlockTemplateEditor::initWidgets() { ); } +void QETTitleBlockTemplateEditor::initLogoManager() { + logo_manager_ = new TitleBlockTemplateLogoManager(tb_template_); + connect( + logo_manager_, + SIGNAL(logosChanged(const TitleBlockTemplate *)), + template_cell_editor_widget_, + SLOT(updateLogosComboBox(const TitleBlockTemplate *)) + ); +} + /** Update various things when user changes the selected cells. @param selected_cells List of selected cells. diff --git a/sources/titleblock/qettemplateeditor.h b/sources/titleblock/qettemplateeditor.h index ef047e038..5a31e2fda 100644 --- a/sources/titleblock/qettemplateeditor.h +++ b/sources/titleblock/qettemplateeditor.h @@ -80,6 +80,7 @@ class QETTitleBlockTemplateEditor : public QMainWindow { void initActions(); void initMenus(); void initWidgets(); + void initLogoManager(); public slots: void selectedCellsChanged(QList); diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index a655beae6..1909215f5 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -50,6 +50,13 @@ QString TitleBlockTemplateLogoManager::currentLogo() const { return(current_item -> text()); } +/** + Emit the logosChanged() signal. +*/ +void TitleBlockTemplateLogoManager::emitLogosChangedSignal() { + emit(logosChanged(const_cast(managed_template_))); +} + /** Initialize widgets composing the Logo manager */ @@ -264,6 +271,7 @@ void TitleBlockTemplateLogoManager::addLogo() { open_dialog_dir_ = QDir(filepath); if (managed_template_ -> addLogoFromFile(filepath, logo_name)) { fillView(); + emitLogosChangedSignal(); } } @@ -275,7 +283,8 @@ void TitleBlockTemplateLogoManager::removeLogo() { if (current_logo.isNull()) return; if (managed_template_ -> removeLogo(current_logo)) { - fillView(); + fillView(); + emitLogosChangedSignal(); } } @@ -317,5 +326,6 @@ void TitleBlockTemplateLogoManager::renameLogo() { if (managed_template_ -> renameLogo(current_logo, entered_name)) { fillView(); + emitLogosChangedSignal(); } } diff --git a/sources/titleblock/templatelogomanager.h b/sources/titleblock/templatelogomanager.h index 17cccc939..d3f295509 100644 --- a/sources/titleblock/templatelogomanager.h +++ b/sources/titleblock/templatelogomanager.h @@ -35,7 +35,12 @@ class TitleBlockTemplateLogoManager : public QWidget { public: QString currentLogo() const; + signals: + void logosChanged(const TitleBlockTemplate *); + protected: + void emitLogosChangedSignal(); + private: void initWidgets(); void fillView();