kwave  18.07.70
Kwave::AboutDialog Class Reference

#include <AboutDialog.h>

Inheritance diagram for Kwave::AboutDialog:
Inheritance graph
Collaboration diagram for Kwave::AboutDialog:
Collaboration graph

Public Member Functions

 AboutDialog (QWidget *parent, const QList< Kwave::PluginManager::PluginModule > &plugin_info)
 
virtual ~AboutDialog ()
 

Detailed Description

Dialog for Help/About

Definition at line 38 of file AboutDialog.h.

Constructor & Destructor Documentation

◆ AboutDialog()

Kwave::AboutDialog::AboutDialog ( QWidget *  parent,
const QList< Kwave::PluginManager::PluginModule > &  plugin_info 
)

Constructor

Parameters
parentthe parent widget
plugin_infolist of plugin info structures (unsorted)

Definition at line 59 of file AboutDialog.cpp.

References _, Kwave::AboutContainer::addPerson(), Kwave::AboutContainer::addWidget(), EMAIL_OF_TRANSLATORS, Kwave::PluginManager::PluginModule::m_author, Kwave::PluginManager::PluginModule::m_description, Kwave::PluginManager::PluginModule::m_version, NAME_OF_TRANSLATORS, and pluginInfoDescriptionLessThan().

63  :QDialog(parent), Ui::AboutDialogBase()
64 {
65  setupUi(this);
66 
67  /* get the about data defined in main() */
68  KAboutData about_data = KAboutData::applicationData();
69 
70  /* display version information in the header */
71  QString kde_version = QString::fromLatin1(KXMLGUI_VERSION_STRING);
72  QString kwave_version = about_data.componentName()+
73  _(" ") + about_data.version() + _(" ");
74  QString header_text = _("<h2>") + kwave_version +
75  i18n("(built with KDE Frameworks %1)", kde_version) + _("</h2>");
76  header->setText(header_text);
77 
78  /* the frame containing the developer information */
80  foreach (const KAboutPerson &author, about_data.authors()) {
81  about->addPerson(
82  author.name(),
83  author.emailAddress(),
84  author.webAddress(),
85  author.task()
86  );
87  }
88  authorframe->setWidget(about);
89  authorframe->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
90 
91  /* the frame containing the thanks to ... */
92  Kwave::AboutContainer *contrib = new Kwave::AboutContainer(this);
93  foreach (const KAboutPerson &credit, about_data.credits()) {
94  contrib->addPerson(
95  credit.name(),
96  credit.emailAddress(),
97  credit.webAddress(),
98  credit.task()
99  );
100  }
101  thanksframe->setWidget(contrib);
102  thanksframe->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
103 
104  /* the frame containing the plugins info */
105  QTreeWidget *pluginsinfo = new QTreeWidget(pluginsinfoframe);
106  QVBoxLayout *plugins_layout = new QVBoxLayout(pluginsinfoframe);
107  plugins_layout->addWidget(pluginsinfo);
108  pluginsinfoframe->setLayout(plugins_layout);
109 
110  pluginsinfo->setColumnCount(3);
111  pluginsinfo->setSizePolicy(QSizePolicy::MinimumExpanding,
112  QSizePolicy::Expanding);
113  pluginsinfo->setSelectionMode(QAbstractItemView::NoSelection);
114  QStringList headers;
115  headers << i18n("name") << i18n("version") << i18n("authors");
116  pluginsinfo->setHeaderLabels(headers);
117  pluginsinfo->setAllColumnsShowFocus( false );
118  pluginsinfo->setItemsExpandable(false);
119  pluginsinfo->setRootIsDecorated(false);
120 
121  QList<QTreeWidgetItem *> plugins;
122 
123  QList<Kwave::PluginManager::PluginModule> list = plugin_info;
124  if (!list.isEmpty()) {
125  std::sort(list.begin(), list.end(), pluginInfoDescriptionLessThan);
126  foreach (const Kwave::PluginManager::PluginModule &info, list) {
127  QStringList item;
128  item << info.m_description
129  << info.m_version
130  << info.m_author;
131  plugins.append(new QTreeWidgetItem(
132  static_cast<QTreeWidget *>(Q_NULLPTR), item));
133  }
134  pluginsinfo->insertTopLevelItems(0, plugins);
135  }
136  pluginsinfo->resizeColumnToContents(1);
137  pluginsinfo->resizeColumnToContents(0);
138 
139  QString num_plugins = i18n("Plugins found: %1", plugins.count());
140  pluginsnumval->setText(num_plugins);
141  pluginsinfoframe->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
142 
143  /* set the url of the kwave homepage */
144  kwave_url_label->setText(_("<a href=\"") +
145  about_data.homepage() + _("\">") +
146  about_data.homepage() + _("</a>"));
147  kwave_url_label->setOpenExternalLinks(true);
148  kwave_url_label->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
149 
150  /* the frame containing the translators */
151  Kwave::AboutContainer *trans = new Kwave::AboutContainer(this);
152  QList<KAboutPerson> translators = about_data.translators();
153 
154  /* ----------- begin workaround KDE #345320 ----------- */
155  /*
156  * workaround for KF5 bug #345320:
157  * do the translation of the translator names on our own, as the
158  * code in kaboutdata.cpp uses QCoreApplication::translate(...) which
159  * relies on a Qt style translation file - that we do not have, we are
160  * using message catalogs.
161  */
162  if (translators.isEmpty()) {
163  about_data.setTranslator(
164  ki18nc("NAME OF TRANSLATORS", NAME_OF_TRANSLATORS).toString(),
165  ki18nc("EMAIL OF TRANSLATORS", EMAIL_OF_TRANSLATORS).toString()
166  );
167  translators = about_data.translators();
168  }
169  /* ------------ end workaround KDE #345320 ------------ */
170 
171  if (translators.isEmpty() || ((translators.count() == 1) &&
172  (translators.first().name() == _(NAME_OF_TRANSLATORS))) ) {
173  tabwidget->removeTab(4);
174  } else {
175  foreach (const KAboutPerson &translator, translators) {
176  QString website = translator.webAddress();
177 
178  // if the translator is already listed in the "authors" section,
179  // give him the same web address
180  foreach (const KAboutPerson &author, about_data.authors())
181  if (author.name() == translator.name()) {
182  website = author.webAddress();
183  break;
184  }
185 
186  // if the translator is already listed in the "credits" section,
187  // give him the same web address
188  foreach (const KAboutPerson &credit, about_data.credits())
189  if (credit.name() == translator.name()) {
190  website = credit.webAddress();
191  break;
192  }
193 
194  trans->addPerson(
195  translator.name(),
196  translator.emailAddress(),
197  website,
198  translator.task()
199  );
200  }
201 
202  QString about_team = about_data.aboutTranslationTeam();
203  if (!about_team.isEmpty()) {
204  about_team.prepend(_("<br>"));
205  trans->addWidget(new(std::nothrow) QLabel(about_team, trans));
206  }
207 
208  translatorsframe->setWidget(trans);
209  translatorsframe->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
210  }
211 
212  /* the frame containing the license(s) */
213  licenseframe->setReadOnly(true);
214  QString licenses;
215  foreach (const KAboutLicense &license, about_data.licenses()) {
216  licenses += license.text();
217  }
218  licenseframe->setText(licenses);
219 
220  // set the focus onto the "OK" button
221  buttonBox->setFocus();
222 }
#define EMAIL_OF_TRANSLATORS
Definition: AboutDialog.cpp:48
void addWidget(QWidget *widget)
#define _(m)
Definition: memcpy.c:66
static bool pluginInfoDescriptionLessThan(const Kwave::PluginManager::PluginModule &info1, const Kwave::PluginManager::PluginModule &info2)
Definition: AboutDialog.cpp:51
void addPerson(const QString &name, const QString &email, const QString &url, const QString &task)
#define NAME_OF_TRANSLATORS
Definition: AboutDialog.cpp:47
Here is the call graph for this function:

◆ ~AboutDialog()

Kwave::AboutDialog::~AboutDialog ( )
virtual

Destructor

Definition at line 225 of file AboutDialog.cpp.

226 {
227 }

The documentation for this class was generated from the following files: