Title block properties: added a "Set to current date" button.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1959 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
cfdev
2012-11-07 21:26:09 +00:00
parent 0ef85e5b97
commit 75c37aa029
2 changed files with 20 additions and 1 deletions

View File

@@ -27,7 +27,7 @@
*/ */
TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current, QWidget *parent) : TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current, QWidget *parent) :
QWidget(parent), QWidget(parent),
display_current_date(false), display_current_date(false),
tbt_collection_(0) tbt_collection_(0)
{ {
initWidgets(titleblock); initWidgets(titleblock);
@@ -297,6 +297,14 @@ void TitleBlockPropertiesWidget::initWidgets(const TitleBlockProperties &titlebl
connect(titleblock_fixed_date, SIGNAL(toggled(bool)), titleblock_date, SLOT(setEnabled(bool))); connect(titleblock_fixed_date, SIGNAL(toggled(bool)), titleblock_date, SLOT(setEnabled(bool)));
titleblock_date -> setCalendarPopup(true); titleblock_date -> setCalendarPopup(true);
titleblock_dateNow = new QPushButton (this);
titleblock_dateNow -> setEnabled(titleblock_fixed_date -> isChecked());
QIcon icon_dateNow(QET::Icons::ArrowLeft);
titleblock_dateNow->setIcon(icon_dateNow);
titleblock_dateNow->setIconSize(QSize(16, 16));
connect(titleblock_fixed_date, SIGNAL(toggled(bool)), titleblock_dateNow, SLOT(setEnabled(bool)));
connect(titleblock_dateNow, SIGNAL(clicked()), this, SLOT(setDateNow()));
// we add a bunch of tooltips for users to know how they can put these // we add a bunch of tooltips for users to know how they can put these
// values into their title block templates // values into their title block templates
QString variable_tooltip = tr("Disponible en tant que %1 pour les mod\350les de cartouches."); QString variable_tooltip = tr("Disponible en tant que %1 pour les mod\350les de cartouches.");
@@ -308,6 +316,7 @@ void TitleBlockPropertiesWidget::initWidgets(const TitleBlockProperties &titlebl
titleblock_current_date -> setToolTip(date_variable_tooltip); titleblock_current_date -> setToolTip(date_variable_tooltip);
titleblock_fixed_date -> setToolTip(date_variable_tooltip); titleblock_fixed_date -> setToolTip(date_variable_tooltip);
titleblock_date -> setToolTip(date_variable_tooltip); titleblock_date -> setToolTip(date_variable_tooltip);
titleblock_dateNow -> setToolTip(tr("Appliquer la date actuelle"));
folio_tip -> setToolTip(tr("%id et %total sont disponibles en tant que %{folio-id} et %{folio-total} (respectivement) pour les mod\350les de cartouches.")); folio_tip -> setToolTip(tr("%id et %total sont disponibles en tant que %{folio-id} et %{folio-total} (respectivement) pour les mod\350les de cartouches."));
// widgets for users to enter their own name/value pairs // widgets for users to enter their own name/value pairs
@@ -340,6 +349,7 @@ void TitleBlockPropertiesWidget::initLayouts() {
layout_date -> addWidget(titleblock_current_date, 1, 0); layout_date -> addWidget(titleblock_current_date, 1, 0);
layout_date -> addWidget(titleblock_fixed_date, 2, 0); layout_date -> addWidget(titleblock_fixed_date, 2, 0);
layout_date -> addWidget(titleblock_date, 2, 1); layout_date -> addWidget(titleblock_date, 2, 1);
layout_date -> addWidget(titleblock_dateNow, 2, 2);
layout_date -> setColumnStretch(0, 1); layout_date -> setColumnStretch(0, 1);
layout_date -> setColumnStretch(1, 500); layout_date -> setColumnStretch(1, 500);
@@ -398,3 +408,10 @@ void TitleBlockPropertiesWidget::initLayouts() {
this_layout -> addWidget(titleblock_infos); this_layout -> addWidget(titleblock_infos);
setLayout(this_layout); setLayout(this_layout);
} }
/**
Set the current Date to the combo Date
*/
void TitleBlockPropertiesWidget::setDateNow(){
titleblock_date->setDate( QDate::currentDate() );
}

View File

@@ -54,6 +54,7 @@ class TitleBlockPropertiesWidget : public QWidget {
void updateTemplateList(); void updateTemplateList();
void editCurrentTitleBlockTemplate(); void editCurrentTitleBlockTemplate();
void duplicateCurrentTitleBlockTemplate(); void duplicateCurrentTitleBlockTemplate();
void setDateNow();
// private methods // private methods
private: private:
@@ -75,6 +76,7 @@ class TitleBlockPropertiesWidget : public QWidget {
QLineEdit *titleblock_title; QLineEdit *titleblock_title;
QLineEdit *titleblock_author; QLineEdit *titleblock_author;
QDateEdit *titleblock_date; QDateEdit *titleblock_date;
QPushButton *titleblock_dateNow;
QLineEdit *titleblock_filename; QLineEdit *titleblock_filename;
QLineEdit *titleblock_folio; QLineEdit *titleblock_folio;
QLabel *folio_tip; QLabel *folio_tip;