[qet] qet/qet: [5189] Add a button in config page for open a new Qfontdialog widget and choose

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


Revision: 5189
Author:   scorpio810
Date:     2017-12-17 15:43:39 +0100 (Sun, 17 Dec 2017)
Log Message:
-----------
Add a button in config page for open a new Qfontdialog widget and choose
font for summarry pages (foliolist)

Modified Paths:
--------------
    trunk/sources/configpages.cpp
    trunk/sources/configpages.h
    trunk/sources/diagramfoliolist.cpp
    trunk/sources/qetapp.cpp
    trunk/sources/qetapp.h

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2017-12-15 01:53:47 UTC (rev 5188)
+++ trunk/sources/configpages.cpp	2017-12-17 14:43:39 UTC (rev 5189)
@@ -261,6 +261,13 @@
 	fontButton = new QPushButton(fontInfos);
 	fontButton->setMinimumHeight(28);
 
+	QString foliolistfontInfos = settings.value("foliolistfont").toString() + " " +
+                        settings.value("foliolistsize").toString() + " (" +
+                        settings.value("folioliststyle").toString() + ")";
+	foliolist_font_label = new QLabel(tr("Police des champs des pages sommaires"));
+	foliolist_fontButton = new QPushButton(foliolistfontInfos);
+	foliolist_fontButton->setMinimumHeight(28);
+
 	elements_management_ = new QGroupBox(tr("Gestion des éléments"), this);
 	highlight_integrated_elements_ = new QCheckBox(tr("Mettre en valeur dans le panel les éléments fraîchement intégrés", "configuration option"));
 	default_element_infos_label_ = new QLabel(
@@ -297,6 +304,7 @@
 	
 	QVBoxLayout *projects_view_mode_layout = new QVBoxLayout;
 	QHBoxLayout *font_view_layout = new QHBoxLayout;
+	QHBoxLayout *foliolist_font_view_layout = new QHBoxLayout;
 	projects_view_mode_layout -> addWidget(windowed_mode_);
 	projects_view_mode_layout -> addWidget(tabbed_mode_);
 	projects_view_mode_layout -> addWidget(m_zoom_out_beyond_folio);
@@ -305,12 +313,18 @@
 	projects_view_mode_layout -> addWidget(folio_panel_);
 	projects_view_mode_layout -> addWidget(terminal_exportlist_);
 	font_view_layout->addWidget(font_label, 1);
-	font_view_layout->addWidget(fontButton, 0);
+	font_view_layout->addWidget(fontButton, 0);	
+	foliolist_font_view_layout->addWidget(foliolist_font_label, 1);
+	foliolist_font_view_layout->addWidget(foliolist_fontButton, 0);
 	projects_view_mode_layout->  addLayout(font_view_layout);
+	projects_view_mode_layout->  addLayout(foliolist_font_view_layout);
 	projects_view_mode_ -> setLayout(projects_view_mode_layout);
+	
 
 	connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
+	connect(foliolist_fontButton, SIGNAL(clicked()), this, SLOT(setFoliolistFont()));
 
+
 	
 	QVBoxLayout *elements_management_layout = new QVBoxLayout();
 	elements_management_layout -> addWidget(highlight_integrated_elements_);
@@ -550,4 +564,23 @@
         fontButton->setText(fontInfos);
 	}
 }
-
+/**
+ * @brief GeneralConfigurationPage::setFoliolistFont
+ * * Apply font to summary pages
+ */
+void GeneralConfigurationPage::setFoliolistFont()
+{
+	bool ok;
+	QSettings settings;
+	QFont font = QFontDialog::getFont(&ok, QFont(), this);
+	if (ok) {
+		settings.setValue("foliolistfont", font.family());
+		settings.setValue("foliolistsize", font.pointSize());
+		settings.setValue("foliolistweight", font.weight());
+		settings.setValue("folioliststyle", font.styleName());
+		QString fontInfos = settings.value("foliolistfont").toString() + " " +
+                            settings.value("foliolistsize").toString() + " (" +
+                            settings.value("folioliststyle").toString() + ")";
+        foliolist_fontButton->setText(fontInfos);
+	}
+}

Modified: trunk/sources/configpages.h
===================================================================
--- trunk/sources/configpages.h	2017-12-15 01:53:47 UTC (rev 5188)
+++ trunk/sources/configpages.h	2017-12-17 14:43:39 UTC (rev 5189)
@@ -93,6 +93,7 @@
 	
 public slots:
 	void setFont();
+	void setFoliolistFont();
 	
 	// attributes
 	private:
@@ -116,8 +117,10 @@
 	QGroupBox *lang_group_box;
 	QComboBox *lang_combo_box;
 	QLabel *lang_label;
-    QLabel *font_label;
+	QLabel *font_label;
 	QPushButton *fontButton;
+	QLabel *foliolist_font_label;
+	QPushButton *foliolist_fontButton;
 };
 
 /**

Modified: trunk/sources/diagramfoliolist.cpp
===================================================================
--- trunk/sources/diagramfoliolist.cpp	2017-12-15 01:53:47 UTC (rev 5188)
+++ trunk/sources/diagramfoliolist.cpp	2017-12-17 14:43:39 UTC (rev 5189)
@@ -127,9 +127,9 @@
 	QSettings settings;
 
 
-	QFontMetrics origFontMetrics(QETApp::diagramTextsFont());
-	qreal origFontSize = QETApp::diagramTextsFont().pointSizeF();
-	QFont workingFont(QETApp::diagramTextsFont());
+	QFontMetrics origFontMetrics(QETApp::foliolistTextsFont());
+	qreal origFontSize = QETApp::foliolistTextsFont().pointSizeF();
+	QFont workingFont(QETApp::foliolistTextsFont());
 
 	if (settings.value("genericpanel/folio", true).toBool()){
 	// reduce the font size if the text entry is long

Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp	2017-12-15 01:53:47 UTC (rev 5188)
+++ trunk/sources/qetapp.cpp	2017-12-17 14:43:39 UTC (rev 5189)
@@ -806,8 +806,32 @@
 	}
 	return(diagram_texts_item_font);
 }
+/**
+ * @brief QETApp::foliolistTextsFont
+ * the font for to use in summary pages
+ * @param size
+ * @return 
+ */
+QFont QETApp::foliolistTextsFont(qreal size)
+{
+	QSettings settings;
 
+		//Font to use
+	QString foliolist_texts_family = settings.value("foliolistfont", "Sans Serif").toString();
+	qreal foliolist_texts_size     = settings.value("foliolistsize", 9.0).toDouble();
 
+	if (size != -1.0) {
+		foliolist_texts_size = size;
+	}
+	QFont foliolist_texts_font = QFont(foliolist_texts_family);
+	foliolist_texts_font.setPointSizeF(foliolist_texts_size);
+	if (foliolist_texts_size <= 4.0) {
+		foliolist_texts_font.setWeight(QFont::Light);
+	}
+	return(foliolist_texts_font);
+}
+
+
 /**
 	@return les editeurs de schemas
 */

Modified: trunk/sources/qetapp.h
===================================================================
--- trunk/sources/qetapp.h	2017-12-15 01:53:47 UTC (rev 5188)
+++ trunk/sources/qetapp.h	2017-12-17 14:43:39 UTC (rev 5189)
@@ -123,6 +123,7 @@
 	static QString lang_dir; ///< Directory containing localization files.
 	static QFont diagramTextsFont(qreal = -1.0);
 	static QFont diagramTextsItemFont(qreal = -1.0);
+	static QFont foliolistTextsFont(qreal = -1.0);
 	static QETDiagramEditor *diagramEditorForFile(const QString &);
 	static QETDiagramEditor *diagramEditorAncestorOf (const QWidget *child);
 	static QList<QETDiagramEditor *> diagramEditors();


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