[qet] [1959] Add currentDate button in schema property ! yeah mdr :)

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1959
Author:   cfdev
Date:     2012-11-07 22:26:09 +0100 (Wed, 07 Nov 2012)
Log Message:
-----------
Add currentDate button in schema property ! yeah mdr :)

Modified Paths:
--------------
    trunk/sources/titleblockpropertieswidget.cpp
    trunk/sources/titleblockpropertieswidget.h

Modified: trunk/sources/titleblockpropertieswidget.cpp
===================================================================
--- trunk/sources/titleblockpropertieswidget.cpp	2012-11-05 18:19:25 UTC (rev 1958)
+++ trunk/sources/titleblockpropertieswidget.cpp	2012-11-07 21:26:09 UTC (rev 1959)
@@ -27,7 +27,7 @@
 */
 TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock, bool current, QWidget *parent) :
 	QWidget(parent),
-	display_current_date(false),
+    display_current_date(false),
 	tbt_collection_(0)
 {
 	initWidgets(titleblock);
@@ -297,6 +297,14 @@
 	connect(titleblock_fixed_date, SIGNAL(toggled(bool)), titleblock_date, SLOT(setEnabled(bool)));
 	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
 	// values into their title block templates
 	QString variable_tooltip = tr("Disponible en tant que %1 pour les mod\350les de cartouches.");
@@ -308,6 +316,7 @@
 	titleblock_current_date -> setToolTip(date_variable_tooltip);
 	titleblock_fixed_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."));
 	
 	// widgets for users to enter their own name/value pairs
@@ -340,6 +349,7 @@
 	layout_date -> addWidget(titleblock_current_date, 1, 0);
 	layout_date -> addWidget(titleblock_fixed_date,   2, 0);
 	layout_date -> addWidget(titleblock_date,         2, 1);
+    layout_date -> addWidget(titleblock_dateNow,      2, 2);
 	layout_date -> setColumnStretch(0, 1);
 	layout_date -> setColumnStretch(1, 500);
 	
@@ -398,3 +408,10 @@
 	this_layout -> addWidget(titleblock_infos);
 	setLayout(this_layout);
 }
+
+/**
+    Set the current Date to the combo Date
+  */
+void TitleBlockPropertiesWidget::setDateNow(){
+        titleblock_date->setDate( QDate::currentDate() );
+}

Modified: trunk/sources/titleblockpropertieswidget.h
===================================================================
--- trunk/sources/titleblockpropertieswidget.h	2012-11-05 18:19:25 UTC (rev 1958)
+++ trunk/sources/titleblockpropertieswidget.h	2012-11-07 21:26:09 UTC (rev 1959)
@@ -54,6 +54,7 @@
 	void updateTemplateList();
 	void editCurrentTitleBlockTemplate();
 	void duplicateCurrentTitleBlockTemplate();
+    void setDateNow();
 	
 	// private methods
 	private:
@@ -75,6 +76,7 @@
 	QLineEdit    *titleblock_title;
 	QLineEdit    *titleblock_author;
 	QDateEdit    *titleblock_date;
+    QPushButton  *titleblock_dateNow;
 	QLineEdit    *titleblock_filename;
 	QLineEdit    *titleblock_folio;
 	QLabel       *folio_tip;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/