1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef PRINTLANGUAGECOMBO_H
8 #define PRINTLANGUAGECOMBO_H
9 
10 #include <QComboBox>
11 #include <QEvent>
12 
13 #include "scribusapi.h"
14 #include "scribusstructs.h"
15 
16 /*!
17     \class PrintLanguageCombo printlanguagecombo.h
18     \brief The PrintLanguageCombo widget is a combo box for displaying print languages
19 */
20 class SCRIBUS_API PrintLanguageCombo : public QComboBox
21 {
22 	Q_OBJECT
23 
24 public:
25 	PrintLanguageCombo(QWidget* parent = nullptr);
26 
27 	/**
28 	 * @brief Retrieve currently selected language
29 	 */
30 	PrintLanguage currentLanguage() const;
31 
32 	/**
33 	 * @brief Add a print language to current combobox
34 	 */
35 	void addLanguage(PrintLanguage prnLanguage);
36 
37 	/**
38 	 * @brief Find item index for specified print language
39 	 */
40 	int findLanguage(PrintLanguage prnLanguage) const;
41 
42 	/**
43 	 * @brief Returns if combobox currently contains specified language
44 	 */
45 	bool hasLanguage(PrintLanguage prnLanguage) const;
46 
47 	/**
48 	 * @brief Returns if PDF is currently available in combobox
49 	 */
50 	bool hasPDF() const;
51 
52 	/**
53 	 * @brief Returns if Postscript 1, 2, or 3 is currently available in combobox
54 	 */
55 	bool hasPostscript() const;
56 
57 	/**
58 	 * @brief Retrieve print language at specified item index
59 	 */
60 	PrintLanguage languageAt(int index) const;
61 
62 	/**
63 	 * @brief Define current print language
64 	 */
65 	void setCurrentLanguage(PrintLanguage prnLanguage);
66 
67 	/**
68 	 * @brief Set supported languages for specified printer
69 	 */
70 	void setupLanguages(const QString& printerName, bool toFile);
71 
72 protected:
73 	/**
74 	 * @brief Process change events
75 	 */
76 	void changeEvent(QEvent* e) override;
77 
78 	/**
79 	 * @brief Process language change event
80 	 */
81 	void languageChange();
82 };
83 
84 #endif
85