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
This commit is contained in:
xavier
2011-12-30 02:42:50 +00:00
parent 5a1d557668
commit 853d169549
4 changed files with 28 additions and 3 deletions

View File

@@ -98,10 +98,9 @@ bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &templ
void QETTitleBlockTemplateEditor::editLogos() { void QETTitleBlockTemplateEditor::editLogos() {
if (tb_template_) { if (tb_template_) {
if (!logo_manager_) { if (!logo_manager_) {
logo_manager_ = new TitleBlockTemplateLogoManager(tb_template_); initLogoManager();
} }
logo_manager_ -> show(); 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. Update various things when user changes the selected cells.
@param selected_cells List of selected cells. @param selected_cells List of selected cells.

View File

@@ -80,6 +80,7 @@ class QETTitleBlockTemplateEditor : public QMainWindow {
void initActions(); void initActions();
void initMenus(); void initMenus();
void initWidgets(); void initWidgets();
void initLogoManager();
public slots: public slots:
void selectedCellsChanged(QList<TitleBlockCell *>); void selectedCellsChanged(QList<TitleBlockCell *>);

View File

@@ -50,6 +50,13 @@ QString TitleBlockTemplateLogoManager::currentLogo() const {
return(current_item -> text()); return(current_item -> text());
} }
/**
Emit the logosChanged() signal.
*/
void TitleBlockTemplateLogoManager::emitLogosChangedSignal() {
emit(logosChanged(const_cast<const TitleBlockTemplate *>(managed_template_)));
}
/** /**
Initialize widgets composing the Logo manager Initialize widgets composing the Logo manager
*/ */
@@ -264,6 +271,7 @@ void TitleBlockTemplateLogoManager::addLogo() {
open_dialog_dir_ = QDir(filepath); open_dialog_dir_ = QDir(filepath);
if (managed_template_ -> addLogoFromFile(filepath, logo_name)) { if (managed_template_ -> addLogoFromFile(filepath, logo_name)) {
fillView(); fillView();
emitLogosChangedSignal();
} }
} }
@@ -275,7 +283,8 @@ void TitleBlockTemplateLogoManager::removeLogo() {
if (current_logo.isNull()) return; if (current_logo.isNull()) return;
if (managed_template_ -> removeLogo(current_logo)) { if (managed_template_ -> removeLogo(current_logo)) {
fillView(); fillView();
emitLogosChangedSignal();
} }
} }
@@ -317,5 +326,6 @@ void TitleBlockTemplateLogoManager::renameLogo() {
if (managed_template_ -> renameLogo(current_logo, entered_name)) { if (managed_template_ -> renameLogo(current_logo, entered_name)) {
fillView(); fillView();
emitLogosChangedSignal();
} }
} }

View File

@@ -35,7 +35,12 @@ class TitleBlockTemplateLogoManager : public QWidget {
public: public:
QString currentLogo() const; QString currentLogo() const;
signals:
void logosChanged(const TitleBlockTemplate *);
protected: protected:
void emitLogosChangedSignal();
private: private:
void initWidgets(); void initWidgets();
void fillView(); void fillView();