[libcalamaresui] Coding style

- Apply coding style
- Place the widget classes in namespace Calamares
- Export symbols for widgets
main
Adriaan de Groot 5 years ago
parent c4951d5090
commit 3b7c3c4f5d

@ -18,7 +18,10 @@
#include "ClickableLabel.h"
#include <QApplication>
#include <QApplication> // for doubleClickInterval()
namespace Calamares
{
ClickableLabel::ClickableLabel( QWidget* parent )
@ -53,3 +56,5 @@ ClickableLabel::mouseReleaseEvent( QMouseEvent* event )
emit clicked();
}
}
} // namespace Calamares

@ -20,8 +20,13 @@
#ifndef LIBCALAMARESUI_CLICKABLELABEL_H
#define LIBCALAMARESUI_CLICKABLELABEL_H
#include <QLabel>
#include <QElapsedTimer>
#include <QLabel>
#include "DllMacro.h"
namespace Calamares
{
/** @brief A Label where the whole label area is clickable
*
@ -30,7 +35,7 @@
* buttons or other clickable things where you want mouse interaction
* with the label, to be the same as mouse interaction with the control.
*/
class ClickableLabel : public QLabel
class UIDLLEXPORT ClickableLabel : public QLabel
{
Q_OBJECT
public:
@ -49,4 +54,6 @@ private:
QElapsedTimer m_time;
};
} // namespace Calamares
#endif // LIBCALAMARESUI_CLICKABLELABEL_H

@ -26,6 +26,8 @@
#include <QHBoxLayout>
#include <QLabel>
namespace Calamares
{
PrettyRadioButton::PrettyRadioButton( QWidget* parent )
: QWidget( parent )
@ -45,10 +47,8 @@ PrettyRadioButton::PrettyRadioButton( QWidget* parent )
m_mainLayout->addWidget( m_label, 0, 1 );
m_mainLayout->setContentsMargins( 0, 0, 0, 0 );
connect( m_label, &ClickableLabel::clicked,
m_radio, &QRadioButton::click );
connect( m_radio, &QRadioButton::toggled,
this, &PrettyRadioButton::toggleOptions );
connect( m_label, &ClickableLabel::clicked, m_radio, &QRadioButton::click );
connect( m_radio, &QRadioButton::toggled, this, &PrettyRadioButton::toggleOptions );
}
@ -90,7 +90,9 @@ void
PrettyRadioButton::addOptionsComboBox( QComboBox* box )
{
if ( !box )
{
return;
}
if ( !m_optionsLayout )
{
@ -105,12 +107,16 @@ PrettyRadioButton::addOptionsComboBox( QComboBox* box )
toggleOptions( m_radio->isChecked() );
}
m_optionsLayout->insertWidget( m_optionsLayout->count()-1, box );
m_optionsLayout->insertWidget( m_optionsLayout->count() - 1, box );
}
void
PrettyRadioButton::toggleOptions( bool toggle )
{
if ( m_optionsLayout )
{
m_optionsLayout->parentWidget()->setVisible( toggle );
}
}
} // namespace Calamares

@ -19,13 +19,18 @@
#ifndef LIBCALAMARESUI_PRETTYRADIOBUTTON_H
#define LIBCALAMARESUI_PRETTYRADIOBUTTON_H
#include "DllMacro.h"
#include <QRadioButton>
class ClickableLabel;
class QComboBox;
class QGridLayout;
class QHBoxLayout;
namespace Calamares
{
class ClickableLabel;
/** @brief A radio button with fancy label next to it.
*
* The radio button itself can be retrieved with buttonWidget(),
@ -33,12 +38,12 @@ class QHBoxLayout;
* added to the display (options are hidden when the button is
* not selected) with addOptionsComboBox().
*/
class PrettyRadioButton : public QWidget
class UIDLLEXPORT PrettyRadioButton : public QWidget
{
Q_OBJECT
public:
explicit PrettyRadioButton( QWidget* parent = nullptr );
virtual ~PrettyRadioButton() {}
virtual ~PrettyRadioButton() { }
virtual void setText( const QString& text );
@ -64,4 +69,5 @@ protected:
QHBoxLayout* m_optionsLayout;
};
#endif // LIBCALAMARESUI_PRETTYRADIOBUTTON_H
} // namespace Calamares
#endif // LIBCALAMARESUI_PRETTYRADIOBUTTON_H

Loading…
Cancel
Save