kwave  18.07.70
Kwave::AboutContributor Class Reference

#include <AboutContainer.h>

Inheritance diagram for Kwave::AboutContributor:
Inheritance graph
Collaboration diagram for Kwave::AboutContributor:
Collaboration graph

Public Member Functions

 AboutContributor (QWidget *parent, const QString &username, const QString &email, const QString &url, const QString &work)
 
virtual ~AboutContributor () Q_DECL_OVERRIDE
 
QSize sizeHint () const Q_DECL_OVERRIDE
 

Protected Member Functions

virtual void fontChange (const QFont &oldFont)
 
virtual void updateLayout ()
 

Private Attributes

QLabel * m_text [4]
 

Detailed Description

Used internally by KwaveAboutWidget

See also
K3AboutContributor

Definition at line 71 of file AboutContainer.h.

Constructor & Destructor Documentation

◆ AboutContributor()

Kwave::AboutContributor::AboutContributor ( QWidget *  parent,
const QString &  username,
const QString &  email,
const QString &  url,
const QString &  work 
)

Definition at line 152 of file AboutContainer.cpp.

References _, fontChange(), m_text, and updateLayout().

157  :QFrame(_parent)
158 {
159  for (int i=0; i < 4; ++i) {
160  m_text[i] = new QLabel(this);
161  Q_ASSERT(m_text[i]);
162  if (!m_text[i]) return;
163  m_text[i]->setOpenExternalLinks(true);
164  m_text[i]->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
165  }
166 
167  // set name
168  m_text[0]->setText(_name);
169 
170  // set email
171  if (!_email.isEmpty())
172  m_text[1]->setText(_("<a href=\"mailto:%1\">%1</a>").arg(_email));
173 
174  // set url
175  if (!_url.isEmpty())
176  m_text[2]->setText(_("<a href=\"%1\">%1</a>").arg(_url));
177 
178  // set work
179  m_text[3]->setText(_work);
180 
181  fontChange(font());
182  updateLayout();
183 }
virtual void fontChange(const QFont &oldFont)
#define _(m)
Definition: memcpy.c:66
Here is the call graph for this function:

◆ ~AboutContributor()

Kwave::AboutContributor::~AboutContributor ( )
virtual

Definition at line 186 of file AboutContainer.cpp.

187 {
188 }

Member Function Documentation

◆ fontChange()

void Kwave::AboutContributor::fontChange ( const QFont &  oldFont)
protectedvirtual

Definition at line 191 of file AboutContainer.cpp.

Referenced by AboutContributor().

192 {
193  update();
194 }
Here is the caller graph for this function:

◆ sizeHint()

QSize Kwave::AboutContributor::sizeHint ( void  ) const

Definition at line 197 of file AboutContainer.cpp.

Referenced by updateLayout().

198 {
199  return minimumSizeHint();
200 }
Here is the caller graph for this function:

◆ updateLayout()

void Kwave::AboutContributor::updateLayout ( )
protectedvirtual

Definition at line 203 of file AboutContainer.cpp.

References m_text, and sizeHint().

Referenced by AboutContributor().

204 {
205  if (layout()) delete layout();
206 
207  int row = 0;
208  if (!m_text[0] || !m_text[0]->text().isEmpty()) { ++row; }
209  if (!m_text[1] || !m_text[1]->text().isEmpty()) { ++row; }
210  if (!m_text[2] || !m_text[2]->text().isEmpty()) { ++row; }
211  if (!m_text[3] || !m_text[3]->text().isEmpty()) { ++row; }
212 
213  QGridLayout *gbox;
214  if (row == 0) {
215  gbox = new QGridLayout(this);
216  Q_ASSERT(gbox);
217  if (!gbox) return;
218  gbox->setSpacing(1);
219  for (int i=0; i<4; ++i)
220  if (m_text[i]) m_text[i]->hide();
221  } else {
222  if (m_text[0] && m_text[0]->text().isEmpty()) {
223  gbox = new QGridLayout(this);
224  Q_ASSERT(gbox);
225  if (!gbox) return;
226  gbox->setMargin(frameWidth()+1);
227  gbox->setSpacing(2);
228  } else {
229  gbox = new QGridLayout(this);
230  Q_ASSERT(gbox);
231  if (!gbox) return;
232  gbox->setMargin(frameWidth()+1);
233  gbox->setSpacing(2);
234  gbox->addItem(new QSpacerItem(20, 0), 0, 0);
235  gbox->setColumnStretch(1, 10);
236  }
237 
238  for (int i = 0, r = 0; i < 4; ++i) {
239  if (!m_text[i]) continue;
240 
241  if (i != 3) {
242  m_text[i]->setFixedHeight(fontMetrics().lineSpacing());
243  }
244 
245  if (!m_text[i]->text().isEmpty()) {
246  if (!i) {
247  gbox->addWidget(m_text[i], r, 0, 1, 2, Qt::AlignLeft);
248  } else {
249  gbox->addWidget(m_text[i], r, 1, Qt::AlignLeft );
250  }
251  m_text[i]->show();
252  ++r;
253  } else {
254  m_text[i]->hide();
255  }
256  }
257  }
258 
259  gbox->activate();
260  setMinimumSize(sizeHint());
261 }
QSize sizeHint() const Q_DECL_OVERRIDE
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_text

QLabel* Kwave::AboutContributor::m_text[4]
private

Definition at line 93 of file AboutContainer.h.

Referenced by AboutContributor(), and updateLayout().


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