[libcalamaresui] Coding style

- Apply coding style
- Place the widget classes in namespace Calamares
- Export symbols for widgets
This commit is contained in:
Adriaan de Groot 2020-05-18 10:53:23 +02:00
parent c4951d5090
commit 3b7c3c4f5d
4 changed files with 36 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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 )
{
@ -112,5 +114,9 @@ void
PrettyRadioButton::toggleOptions( bool toggle )
{
if ( m_optionsLayout )
{
m_optionsLayout->parentWidget()->setVisible( toggle );
}
}
} // namespace Calamares

View File

@ -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,7 +38,7 @@ 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:
@ -64,4 +69,5 @@ protected:
QHBoxLayout* m_optionsLayout;
};
} // namespace Calamares
#endif // LIBCALAMARESUI_PRETTYRADIOBUTTON_H