Apply clang-format changes

This commit is contained in:
Arun Raghavan 2025-09-17 11:50:31 -04:00
parent b53ad2a96d
commit 121f2a86c3
14 changed files with 151 additions and 138 deletions

View file

@ -24,20 +24,20 @@
#include "pavucontrol.h"
class PortInfo {
public:
Glib::ustring name;
Glib::ustring description;
uint32_t priority;
int available;
int direction;
int64_t latency_offset;
std::vector<Glib::ustring> profiles;
public:
Glib::ustring name;
Glib::ustring description;
uint32_t priority;
int available;
int direction;
int64_t latency_offset;
std::vector<Glib::ustring> profiles;
};
class CardWidget : public Gtk::Box {
public:
CardWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static CardWidget* create();
public:
CardWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
static CardWidget *create();
Gtk::Label *nameLabel;
Gtk::Image *iconImage;
@ -65,32 +65,32 @@ public:
void prepareMenu();
protected:
virtual void onProfileChange();
virtual void onCodecChange();
virtual void onProfileLockToggleButton();
protected:
virtual void onProfileChange();
virtual void onCodecChange();
virtual void onProfileLockToggleButton();
/* Tree model columns */
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
/* Tree model columns */
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns() {
add(name);
add(desc);
}
ModelColumns()
{ add(name); add(desc); }
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> desc;
};
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> desc;
};
ModelColumns profileModel;
ModelColumns profileModel;
Gtk::ComboBox *profileList;
Glib::RefPtr<Gtk::ListStore> profileListStore;
Gtk::ComboBox *profileList;
Glib::RefPtr<Gtk::ListStore> profileListStore;
ModelColumns codecModel;
ModelColumns codecModel;
Gtk::ComboBox *codecList;
Glib::RefPtr<Gtk::ListStore> codecListStore;
Gtk::ComboBox *codecList;
Glib::RefPtr<Gtk::ListStore> codecListStore;
};
#endif

View file

@ -26,12 +26,13 @@
class MinimalStreamWidget;
class ChannelWidget : public Gtk::Widget {
public:
ChannelWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
public:
ChannelWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
/* This creates multiple ChannelWidgets based on the given channel map. The
* widgets are stored in the caller-provided array. */
static void create(MinimalStreamWidget *owner, const pa_channel_map &m, bool can_decibel,
static void create(MinimalStreamWidget *owner, const pa_channel_map &m,
bool can_decibel,
ChannelWidget *widgets[PA_CHANNELS_MAX]);
void setVolume(pa_volume_t volume);
@ -52,9 +53,11 @@ public:
virtual void set_sensitive(bool enabled);
virtual void setBaseVolume(pa_volume_t);
private:
private:
pa_volume_t currentVolume;
static ChannelWidget *createOne(MinimalStreamWidget *owner, int channelIndex, pa_channel_position channelPosition,
static ChannelWidget *createOne(MinimalStreamWidget *owner,
int channelIndex,
pa_channel_position channelPosition,
bool can_decibel);
};

View file

@ -27,9 +27,9 @@ class MainWindow;
class ChannelWidget;
class DeviceWidget : public MinimalStreamWidget {
public:
DeviceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
void init(MainWindow* mainWindow, Glib::ustring);
public:
DeviceWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
void init(MainWindow *mainWindow, Glib::ustring);
void setChannelMap(const pa_channel_map &m, bool can_decibel);
void setVolume(const pa_cvolume &volume, bool force = false);
@ -41,7 +41,8 @@ public:
Glib::ustring description;
uint32_t index, card_index;
Gtk::ToggleButton *lockToggleButton, *muteToggleButton, *defaultToggleButton;
Gtk::ToggleButton *lockToggleButton, *muteToggleButton,
*defaultToggleButton;
Gtk::SpinButton *offsetButton;
bool offsetButtonEnabled;
@ -71,9 +72,9 @@ public:
void prepareMenu();
void openRenamePopup(const Glib::VariantBase& parameter);
void openRenamePopup(const Glib::VariantBase &parameter);
protected:
protected:
MainWindow *mpMainWindow;
/* Shows or hides the advanced options expander depending on whether it's
@ -86,12 +87,12 @@ protected:
Gtk::PopoverMenu contextMenu;
/* Tree model columns */
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns()
{ add(name); add(desc); }
ModelColumns() {
add(name);
add(desc);
}
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> desc;
@ -109,17 +110,19 @@ protected:
* support format configuration). */
bool mDigital;
private:
private:
Glib::ustring mDeviceType;
};
class RenameWindow : public Gtk::ApplicationWindow {
public:
RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x, const gchar* name, const gchar* key);
Gtk::Entry* renameText;
const gchar* deviceKey;
private:
void doRename(const Glib::VariantBase& parameter);
public:
RenameWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x,
const gchar *name, const gchar *key);
Gtk::Entry *renameText;
const gchar *deviceKey;
private:
void doRename(const Glib::VariantBase &parameter);
};
#endif

View file

@ -41,10 +41,10 @@
#define N_(String) (String)
#define textdomain(String) (String)
#define gettext(String) (String)
#define dgettext(Domain,String) (String)
#define dcgettext(Domain,String,Type) (String)
#define bindtextdomain(Domain,Directory) (Domain)
#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
#define dgettext(Domain, String) (String)
#define dcgettext(Domain, String, Type) (String)
#define bindtextdomain(Domain, Directory) (Domain)
#define bind_textdomain_codeset(Domain, Codeset) (Codeset)
#endif /* ENABLE_NLS */

View file

@ -26,7 +26,7 @@ class MainWindow;
#include "pavucontrol.h"
#include <pulse/ext-stream-restore.h>
#if HAVE_EXT_DEVICE_RESTORE_API
# include <pulse/ext-device-restore.h>
#include <pulse/ext-device-restore.h>
#endif
#ifdef HAVE_LIBCANBERRA
@ -43,9 +43,9 @@ class SourceOutputWidget;
class RoleWidget;
class MainWindow : public Gtk::Window {
public:
MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static MainWindow* create(bool maximize);
public:
MainWindow(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
static MainWindow *create(bool maximize);
virtual ~MainWindow();
void updateCard(const pa_card_info &info);
@ -55,15 +55,19 @@ public:
void updateSourceOutput(const pa_source_output_info &info);
void updateClient(const pa_client_info &info);
void updateServer(const pa_server_info &info);
void updateVolumeMeter(uint32_t source_index, uint32_t sink_input_index, double v);
void updateVolumeMeter(uint32_t source_index, uint32_t sink_input_index,
double v);
void updateRole(const pa_ext_stream_restore_info &info);
#if HAVE_EXT_DEVICE_RESTORE_API
void updateDeviceInfo(const pa_ext_device_restore_info &info);
#endif
void updateCardCodecs(const std::string& card_name, const std::unordered_map<std::string, std::string>& codecs);
void setActiveCodec(const std::string& card_name, const std::string& codec);
void updateCardCodecs(
const std::string &card_name,
const std::unordered_map<std::string, std::string> &codecs);
void setActiveCodec(const std::string &card_name, const std::string &codec);
void setCardProfileIsSticky(const std::string& card_name, gboolean profile_is_sticky);
void setCardProfileIsSticky(const std::string &card_name,
gboolean profile_is_sticky);
void removeCard(uint32_t index);
void removeSink(uint32_t index);
@ -81,16 +85,19 @@ public:
Gtk::Notebook *notebook;
Gtk::Box *streamsVBox, *recsVBox, *sinksVBox, *sourcesVBox, *cardsVBox;
Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel, *noCardsLabel, *connectingLabel;
Gtk::ComboBox *sinkInputTypeComboBox, *sourceOutputTypeComboBox, *sinkTypeComboBox, *sourceTypeComboBox;
Gtk::CheckButton *showVolumeMetersCheckButton, *hideUnavailableCardProfilesCheckButton;
Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel,
*noCardsLabel, *connectingLabel;
Gtk::ComboBox *sinkInputTypeComboBox, *sourceOutputTypeComboBox,
*sinkTypeComboBox, *sourceTypeComboBox;
Gtk::CheckButton *showVolumeMetersCheckButton,
*hideUnavailableCardProfilesCheckButton;
std::map<uint32_t, CardWidget*> cardWidgets;
std::map<uint32_t, SinkWidget*> sinkWidgets;
std::map<uint32_t, SourceWidget*> sourceWidgets;
std::map<uint32_t, SinkInputWidget*> sinkInputWidgets;
std::map<uint32_t, SourceOutputWidget*> sourceOutputWidgets;
std::map<uint32_t, char*> clientNames;
std::map<uint32_t, CardWidget *> cardWidgets;
std::map<uint32_t, SinkWidget *> sinkWidgets;
std::map<uint32_t, SourceWidget *> sourceWidgets;
std::map<uint32_t, SinkInputWidget *> sinkInputWidgets;
std::map<uint32_t, SourceOutputWidget *> sourceOutputWidgets;
std::map<uint32_t, char *> clientNames;
SinkInputType showSinkInputType;
SinkType showSinkType;
@ -107,10 +114,12 @@ public:
void setConnectionState(gboolean connected);
void updateDeviceVisibility();
void reallyUpdateDeviceVisibility();
pa_stream* createMonitorStreamForSource(uint32_t source_idx, uint32_t stream_idx, bool suspend);
void createMonitorStreamForSinkInput(SinkInputWidget* w, uint32_t sink_idx);
pa_stream *createMonitorStreamForSource(uint32_t source_idx,
uint32_t stream_idx, bool suspend);
void createMonitorStreamForSinkInput(SinkInputWidget *w, uint32_t sink_idx);
void setIconFromProplist(Gtk::Image *icon, pa_proplist *l, const char *name);
void setIconFromProplist(Gtk::Image *icon, pa_proplist *l,
const char *name);
RoleWidget *eventRoleWidget;
@ -125,14 +134,14 @@ public:
ca_context *canberraContext;
#endif
protected:
protected:
virtual void on_realize();
virtual bool on_key_press_event(guint keyval, guint keycode, Gdk::ModifierType state);
virtual bool on_key_press_event(guint keyval, guint keycode,
Gdk::ModifierType state);
private:
private:
gboolean m_connected;
gchar* m_config_filename;
gchar *m_config_filename;
};
#endif

View file

@ -28,8 +28,8 @@
#define DECAY_STEP (1.0 / PEAKS_RATE)
class MinimalStreamWidget : public Gtk::Box {
public:
MinimalStreamWidget(BaseObjectType* cobject);
public:
MinimalStreamWidget(BaseObjectType *cobject);
virtual ~MinimalStreamWidget();
/* Subclass constructors are expected to initialize these variables.
@ -57,13 +57,13 @@ public:
void decayToZero();
void stopDecay();
protected:
protected:
/* Subclasses must call this after the constructor to finalize the initial
* layout. */
void init();
bool decayOnTick(const Glib::RefPtr<Gdk::FrameClock>& frame_clock);
bool decayOnTick(const Glib::RefPtr<Gdk::FrameClock> &frame_clock);
private :
private:
bool volumeMeterVisible;
guint decayTickId;
gint64 decayLastFrameTime;

View file

@ -24,7 +24,7 @@
#include "mainwindow.h"
class PavuApplication : public Gtk::Application {
public:
public:
PavuApplication();
/* Main window */
@ -36,18 +36,17 @@ public:
gint32 tab;
bool version;
static PavuApplication& get_instance();
static PavuApplication &get_instance();
protected:
protected:
// Override default signal handlers:
void on_activate() override;
private:
MainWindow* create_window();
private:
MainWindow *create_window();
bool on_close_window();
pa_glib_mainloop *m;
};
#endif

View file

@ -28,22 +28,18 @@
#include <gtkmm.h>
#include <gtkmm/buildable.h>
#include <pulse/pulseaudio.h>
#include <pulse/glib-mainloop.h>
#include <pulse/pulseaudio.h>
/* Can be removed when PulseAudio 0.9.23 or newer is required */
#ifndef PA_VOLUME_UI_MAX
# define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0))
#define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0))
#endif
#define HAVE_SOURCE_OUTPUT_VOLUMES PA_CHECK_VERSION(0,99,0)
#define HAVE_EXT_DEVICE_RESTORE_API PA_CHECK_VERSION(0,99,0)
#define HAVE_SOURCE_OUTPUT_VOLUMES PA_CHECK_VERSION(0, 99, 0)
#define HAVE_EXT_DEVICE_RESTORE_API PA_CHECK_VERSION(0, 99, 0)
enum SinkInputType {
SINK_INPUT_ALL,
SINK_INPUT_CLIENT,
SINK_INPUT_VIRTUAL
};
enum SinkInputType { SINK_INPUT_ALL, SINK_INPUT_CLIENT, SINK_INPUT_VIRTUAL };
enum SinkType {
SINK_ALL,
@ -67,14 +63,15 @@ enum SourceType {
#include "mainwindow.h"
pa_context* get_context(void);
pa_context *get_context(void);
void show_error(Gtk::Widget *w, const char *txt);
MainWindow* pavucontrol_get_window(pa_glib_mainloop *m, bool maximize, bool retry, int tab_number);
MainWindow *pavucontrol_get_window(pa_glib_mainloop *m, bool maximize,
bool retry, int tab_number);
#ifdef HAVE_PULSE_MESSAGING_API
std::string card_message_handler_path(const std::string& name);
std::string card_bluez_message_handler_path(const std::string& name);
std::string card_message_handler_path(const std::string &name);
std::string card_bluez_message_handler_path(const std::string &name);
#endif
#endif

View file

@ -26,9 +26,9 @@
#include "streamwidget.h"
class RoleWidget : public StreamWidget {
public:
RoleWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static RoleWidget* create();
public:
RoleWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
static RoleWidget *create();
Glib::ustring role;
Glib::ustring device;

View file

@ -28,9 +28,10 @@
class MainWindow;
class SinkInputWidget : public StreamWidget {
public:
SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static SinkInputWidget* create(MainWindow* mainWindow);
public:
SinkInputWidget(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> &x);
static SinkInputWidget *create(MainWindow *mainWindow);
~SinkInputWidget(void);
SinkInputType type;
@ -41,10 +42,10 @@ public:
void updateDeviceComboBox();
virtual void executeVolumeUpdate();
virtual void onMuteToggleButton();
virtual void onKill(const Glib::VariantBase& parameter);
virtual void onKill(const Glib::VariantBase &parameter);
virtual void onDeviceComboBoxChanged();
private:
private:
uint32_t mSinkIndex;
};

View file

@ -21,13 +21,13 @@
#ifndef sinkwidget_h
#define sinkwidget_h
#include "pavucontrol.h"
#include "devicewidget.h"
#include "pavucontrol.h"
#if HAVE_EXT_DEVICE_RESTORE_API
# include <pulse/format.h>
#include <pulse/format.h>
# define PAVU_NUM_ENCODINGS 8
#define PAVU_NUM_ENCODINGS 8
typedef struct {
pa_encoding encoding;
@ -36,9 +36,9 @@ typedef struct {
#endif
class SinkWidget : public DeviceWidget {
public:
SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static SinkWidget* create(MainWindow* mainWindow);
public:
SinkWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
static SinkWidget *create(MainWindow *mainWindow);
SinkType type;
uint32_t monitor_index;
@ -54,7 +54,7 @@ public:
virtual void onDefaultToggleButton();
void setDigital(bool);
protected:
protected:
virtual void onPortChange();
virtual void onEncodingsChange();
};

View file

@ -28,9 +28,10 @@
class MainWindow;
class SourceOutputWidget : public StreamWidget {
public:
SourceOutputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static SourceOutputWidget* create(MainWindow* mainWindow);
public:
SourceOutputWidget(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> &x);
static SourceOutputWidget *create(MainWindow *mainWindow);
~SourceOutputWidget(void);
SourceOutputType type;
@ -43,10 +44,10 @@ public:
virtual void executeVolumeUpdate();
virtual void onMuteToggleButton();
#endif
virtual void onKill(const Glib::VariantBase& parameter);
virtual void onKill(const Glib::VariantBase &parameter);
virtual void onDeviceComboBoxChanged();
private:
private:
uint32_t mSourceIndex;
};

View file

@ -26,9 +26,9 @@
#include "devicewidget.h"
class SourceWidget : public DeviceWidget {
public:
SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static SourceWidget* create(MainWindow* mainWindow);
public:
SourceWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
static SourceWidget *create(MainWindow *mainWindow);
SourceType type;
bool can_decibel;
@ -37,7 +37,7 @@ public:
virtual void executeVolumeUpdate();
virtual void onDefaultToggleButton();
protected:
protected:
virtual void onPortChange();
};

View file

@ -32,9 +32,9 @@ class ChannelWidget;
#define UNKNOWN_DEVICE_NAME "#unknown#"
class StreamWidget : public MinimalStreamWidget {
public:
StreamWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
void init(MainWindow* mainWindow);
public:
StreamWidget(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x);
void init(MainWindow *mainWindow);
void setChannelMap(const pa_channel_map &m, bool can_decibel);
void setVolume(const pa_cvolume &volume, bool force = false);
@ -60,14 +60,14 @@ public:
bool timeoutEvent();
virtual void executeVolumeUpdate();
virtual void onKill(const Glib::VariantBase& parameter);
virtual void onKill(const Glib::VariantBase &parameter);
virtual void onDeviceComboBoxChanged();
protected:
MainWindow* mpMainWindow;
protected:
MainWindow *mpMainWindow;
Gtk::PopoverMenu contextMenu;
void addKillMenu(const char* killLabel);
void addKillMenu(const char *killLabel);
};
#endif