Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang tools testing #5948

Closed
wants to merge 10 commits into from
  •  
  •  
  •  
80 changes: 80 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# Language
Language: Cpp
Standard: Cpp11 # Cpp14 and Cpp17 are not supported by clang 11

# Indentation
TabWidth: 4
UseTab: Always
IndentWidth: 4
ColumnLimit: 120

# Indentation detail
AlignAfterOpenBracket: DontAlign
ContinuationIndentWidth: 4
BreakConstructorInitializers: BeforeComma
ConstructorInitializerIndentWidth: 4
ConstructorInitializerAllOnOneLineOrOnePerLine: false
BinPackParameters: true
BinPackArguments: true
AlignOperands: false

# Alignment
AlignEscapedNewlines: DontAlign
AccessModifierOffset: -4
AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
BreakBeforeBinaryOperators: All

# Includes
IncludeBlocks: Regroup
IncludeCategories:
# windows.h must go before everything else
# otherwise, you will get errors
- Regex: '^<windows.h>$'
Priority: -99
# the "main header" implicitly gets priority 0
# system headers
- Regex: '^<[^>]+>$'
Priority: 1
# non-system headers
- Regex: '.*'
Priority: 2
SortIncludes: true

# Spaces
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false

# Brace wrapping
# Not directly mentioned in the coding conventions,
# but required to avoid tons of auto reformatting
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BeforeWhile: false
BeforeLambdaBody: false

# Pointers
# Use pointer close to type: `const char* const* function()`
PointerAlignment: Left

...

33 changes: 33 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
Checks: 'bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,modernize-use-override,readability-identifier-naming,readability-misleading-indentation,readability-simplify-boolean-expr,readability-braces-around-statements'
WarningsAsErrors: ''
HeaderFilterRegex: '' # don't show errors from headers
AnalyzeTemporaryDtors: false
FormatStyle: none
User: user
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.TypedefCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
# not yet working, as it currently applies both for static and object members
# - key: readability-identifier-naming.MemberPrefix
# value: 'm_'
# currently only working for local static variables:
- key: readability-identifier-naming.StaticVariablePrefix
value: 's_'
# not yet working
# - key: readability-identifier-naming.VariableCase
# value: camelBack
- key: readability-identifier-naming.FunctionCase
value: camelBack
...

12 changes: 3 additions & 9 deletions include/AboutDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,16 @@
*
*/


#ifndef ABOUT_DIALOG_H
#define ABOUT_DIALOG_H

#include <QDialog>

#include "ui_about_dialog.h"


class AboutDialog : public QDialog, public Ui::AboutDialog
{
class AboutDialog : public QDialog, public Ui::AboutDialog {
public:
AboutDialog(QWidget* parent=0);

} ;

AboutDialog(QWidget* parent = 0);
};

#endif

10 changes: 4 additions & 6 deletions include/ActionGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
*/


#ifndef ACTION_GROUP_H
#define ACTION_GROUP_H

Expand All @@ -33,15 +32,14 @@
/// This class provides the same functionality as QActionGroup, but in addition
/// has the actionTriggered(int) signal.
/// It also sets every added action's checkable property to true.
class ActionGroup : public QActionGroup
{
class ActionGroup : public QActionGroup {
Q_OBJECT
public:
ActionGroup(QObject* parent);

QAction* addAction(QAction *a);
QAction* addAction(const QString &text);
QAction* addAction(const QIcon &icon, const QString &text);
QAction* addAction(QAction* a);
QAction* addAction(const QString& text);
QAction* addAction(const QIcon& icon, const QString& text);

signals:
/// This signal is emitted when the action at the given index is triggered.
Expand Down
43 changes: 17 additions & 26 deletions include/AudioAlsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,47 +32,40 @@
// older ALSA-versions might require this
#define ALSA_PCM_NEW_HW_PARAMS_API

#include <alsa/asoundlib.h>
#include <QThread>
#include <alsa/asoundlib.h>

#include "AudioDevice.h"


class AudioAlsa : public QThread, public AudioDevice
{
class AudioAlsa : public QThread, public AudioDevice {
Q_OBJECT
public:
/**
* @brief Contains the relevant information about available ALSA devices
*/
class DeviceInfo
{
class DeviceInfo {
public:
DeviceInfo(QString const & deviceName, QString const & deviceDescription) :
m_deviceName(deviceName),
m_deviceDescription(deviceDescription)
{}
DeviceInfo(QString const& deviceName, QString const& deviceDescription)
: m_deviceName(deviceName)
, m_deviceDescription(deviceDescription) {}
~DeviceInfo() {}

QString const & getDeviceName() const { return m_deviceName; }
QString const & getDeviceDescription() const { return m_deviceDescription; }
QString const& getDeviceName() const { return m_deviceName; }
QString const& getDeviceDescription() const { return m_deviceDescription; }

private:
QString m_deviceName;
QString m_deviceDescription;

};

typedef std::vector<DeviceInfo> DeviceInfoCollection;

public:
AudioAlsa( bool & _success_ful, Mixer* mixer );
AudioAlsa(bool& _success_ful, Mixer* mixer);
virtual ~AudioAlsa();

inline static QString name()
{
return QT_TRANSLATE_NOOP( "AudioDeviceSetupWidget",
"ALSA (Advanced Linux Sound Architecture)" );
inline static QString name() {
return QT_TRANSLATE_NOOP("AudioDeviceSetupWidget", "ALSA (Advanced Linux Sound Architecture)");
}

static QString probeDevice();
Expand All @@ -85,22 +78,20 @@ class AudioAlsa : public QThread, public AudioDevice
void applyQualitySettings() override;
void run() override;

int setHWParams( const ch_cnt_t _channels, snd_pcm_access_t _access );
int setHWParams(const ch_cnt_t _channels, snd_pcm_access_t _access);
int setSWParams();
int handleError( int _err );

int handleError(int _err);

snd_pcm_t * m_handle;
snd_pcm_t* m_handle;

snd_pcm_uframes_t m_bufferSize;
snd_pcm_uframes_t m_periodSize;

snd_pcm_hw_params_t * m_hwParams;
snd_pcm_sw_params_t * m_swParams;
snd_pcm_hw_params_t* m_hwParams;
snd_pcm_sw_params_t* m_swParams;

bool m_convertEndian;

} ;
};

#endif

Expand Down
14 changes: 5 additions & 9 deletions include/AudioAlsaSetupWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,17 @@

#ifdef LMMS_HAVE_ALSA

#include "AudioDeviceSetupWidget.h"

#include "AudioAlsa.h"

#include "AudioDeviceSetupWidget.h"

class QComboBox;
class LcdSpinBox;


class AudioAlsaSetupWidget : public AudioDeviceSetupWidget
{
class AudioAlsaSetupWidget : public AudioDeviceSetupWidget {
Q_OBJECT

public:
AudioAlsaSetupWidget( QWidget * _parent );
AudioAlsaSetupWidget(QWidget* _parent);
virtual ~AudioAlsaSetupWidget();

void saveSettings() override;
Expand All @@ -52,8 +48,8 @@ public slots:
void onCurrentIndexChanged(int index);

private:
QComboBox * m_deviceComboBox;
LcdSpinBox * m_channels;
QComboBox* m_deviceComboBox;
LcdSpinBox* m_channels;

int m_selectedDevice;
AudioAlsa::DeviceInfoCollection m_deviceInfos;
Expand Down
Loading