Skip to content

Commit

Permalink
Run clang-format on everything
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew J. Milner <[email protected]>
  • Loading branch information
matterhorn103 committed Nov 5, 2024
1 parent fdc7f3a commit edbc7e1
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 47 deletions.
3 changes: 2 additions & 1 deletion avogadro/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace Avogadro {

Application::Application(int& argc, char** argv)
: QApplication(argc, argv)
{ }
{
}

// Handle open events (e.g., Mac OS X open files)
bool Application::event(QEvent* event)
Expand Down
13 changes: 8 additions & 5 deletions avogadro/backgroundfileformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ namespace Avogadro {

BackgroundFileFormat::BackgroundFileFormat(Io::FileFormat* format,
QObject* aparent)
: QObject(aparent), m_format(format), m_molecule(nullptr), m_success(false)
: QObject(aparent)
, m_format(format)
, m_molecule(nullptr)
, m_success(false)
{
}

Expand All @@ -35,8 +38,8 @@ void BackgroundFileFormat::read()
m_error = tr("No file name set in BackgroundFileFormat!");

if (m_error.isEmpty()) {
m_success = m_format->readFile(m_fileName.toLocal8Bit().data(),
*m_molecule);
m_success =
m_format->readFile(m_fileName.toLocal8Bit().data(), *m_molecule);

if (!m_success)
m_error = QString::fromStdString(m_format->error());
Expand All @@ -60,8 +63,8 @@ void BackgroundFileFormat::write()
m_error = tr("No file name set in BackgroundFileFormat!");

if (m_error.isEmpty()) {
m_success = m_format->writeFile(m_fileName.toLocal8Bit().data(),
*m_molecule);
m_success =
m_format->writeFile(m_fileName.toLocal8Bit().data(), *m_molecule);

if (!m_success)
m_error = QString::fromStdString(m_format->error());
Expand Down
14 changes: 10 additions & 4 deletions avogadro/mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
#import <AppKit/NSWindow.h>

// Set some Mac compatibility bits using Objective-C++
// From https://forum.qt.io/topic/60623/qt-5-4-2-os-x-10-11-el-capitan-how-to-remove-the-enter-full-screen-menu-item/
// From
// https://forum.qt.io/topic/60623/qt-5-4-2-os-x-10-11-el-capitan-how-to-remove-the-enter-full-screen-menu-item/
// From https://github.com/opencor/opencor/blob/master/src/misc/macos.mm
void removeMacSpecificMenuItems() {
void removeMacSpecificMenuItems()
{
// Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu items
// from the "Edit" menu
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];
[[NSUserDefaults standardUserDefaults]
setBool:YES
forKey:@"NSDisabledDictationMenuItem"];
[[NSUserDefaults standardUserDefaults]
setBool:YES
forKey:@"NSDisabledCharacterPaletteMenuItem"];

#ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
Expand Down
10 changes: 6 additions & 4 deletions avogadro/menubuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ namespace {
*/
struct PriorityText
{
PriorityText(QString string, int pri) : text(std::move(string)), priority(pri) {}
PriorityText(QString string, int pri)
: text(std::move(string))
, priority(pri)
{
}

QString text;
int priority;
Expand All @@ -42,9 +46,7 @@ int floor100(int x)
}
}

MenuBuilder::MenuBuilder()
{
}
MenuBuilder::MenuBuilder() {}

void MenuBuilder::addAction(const QStringList& pathList, QAction* action,
int priority)
Expand Down
39 changes: 20 additions & 19 deletions avogadro/renderingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@

namespace Avogadro {

RenderingDialog::RenderingDialog(QWidget *parent_, SolidPipeline &pipeline)
: QDialog(parent_), m_ui(new Ui::RenderingDialog), m_solidPipeline(pipeline)
RenderingDialog::RenderingDialog(QWidget* parent_, SolidPipeline& pipeline)
: QDialog(parent_)
, m_ui(new Ui::RenderingDialog)
, m_solidPipeline(pipeline)
{
m_ui->setupUi(this);

m_ui->aoEnableCheckBox->setCheckState(pipeline.getAoEnabled()? Qt::Checked : Qt::Unchecked);
m_ui->dofEnableCheckBox->setCheckState(pipeline.getDofEnabled()? Qt::Checked : Qt::Unchecked);
m_ui->fogEnableCheckBox->setCheckState(pipeline.getFogEnabled()? Qt::Checked : Qt::Unchecked);
m_ui->aoEnableCheckBox->setCheckState(
pipeline.getAoEnabled() ? Qt::Checked : Qt::Unchecked);
m_ui->dofEnableCheckBox->setCheckState(
pipeline.getDofEnabled() ? Qt::Checked : Qt::Unchecked);
m_ui->fogEnableCheckBox->setCheckState(
pipeline.getFogEnabled() ? Qt::Checked : Qt::Unchecked);
m_ui->aoStrengthDoubleSpinBox->setMinimum(0.0);
m_ui->aoStrengthDoubleSpinBox->setValue(pipeline.getAoStrength());
m_ui->aoStrengthDoubleSpinBox->setMaximum(2.0);
Expand All @@ -28,7 +33,7 @@ RenderingDialog::RenderingDialog(QWidget *parent_, SolidPipeline &pipeline)
m_ui->dofStrengthDoubleSpinBox->setSingleStep(0.1);
m_ui->dofPositionDoubleSpinBox->setMinimum(0.0);
m_ui->dofPositionDoubleSpinBox->setValue(pipeline.getDofPosition());
// We can adjust the max and min value
// We can adjust the max and min value
// after testing with several molecules
m_ui->dofPositionDoubleSpinBox->setMaximum(20.0);
m_ui->dofPositionDoubleSpinBox->setDecimals(1);
Expand All @@ -43,18 +48,17 @@ RenderingDialog::RenderingDialog(QWidget *parent_, SolidPipeline &pipeline)
m_ui->fogPositionDoubleSpinBox->setMaximum(20.0);
m_ui->fogPositionDoubleSpinBox->setDecimals(1);
m_ui->fogPositionDoubleSpinBox->setSingleStep(0.1);
m_ui->edEnableCheckBox->setCheckState(pipeline.getEdEnabled()? Qt::Checked : Qt::Unchecked);

m_ui->edEnableCheckBox->setCheckState(
pipeline.getEdEnabled() ? Qt::Checked : Qt::Unchecked);

connect(m_ui->aoEnableCheckBox, SIGNAL(stateChanged(int)),
SLOT(aoEnableCheckBoxChanged(int)));
connect(m_ui->dofEnableCheckBox, SIGNAL(stateChanged(int)),
SLOT(dofEnableCheckBoxChanged(int)));
connect(m_ui->fogEnableCheckBox, SIGNAL(stateChanged(int)),
SLOT(fogEnableCheckBoxChanged(int)));
connect(m_ui->saveButton, SIGNAL(clicked()),
SLOT(saveButtonClicked()));
connect(m_ui->closeButton, SIGNAL(clicked()),
SLOT(closeButtonClicked()));
connect(m_ui->saveButton, SIGNAL(clicked()), SLOT(saveButtonClicked()));
connect(m_ui->closeButton, SIGNAL(clicked()), SLOT(closeButtonClicked()));
}

RenderingDialog::~RenderingDialog()
Expand Down Expand Up @@ -105,26 +109,23 @@ bool RenderingDialog::edEnabled()
return m_ui->edEnableCheckBox->checkState() == Qt::Checked;
}


void RenderingDialog::dofEnableCheckBoxChanged(int state)
{
if (state == Qt::Unchecked){
if (state == Qt::Unchecked) {
m_ui->dofStrengthDoubleSpinBox->setEnabled(false);
m_ui->dofPositionDoubleSpinBox->setEnabled(false);
}
else{
} else {
m_ui->dofStrengthDoubleSpinBox->setEnabled(true);
m_ui->dofPositionDoubleSpinBox->setEnabled(true);
}
}

void RenderingDialog::fogEnableCheckBoxChanged(int state)
{
if (state == Qt::Unchecked){
if (state == Qt::Unchecked) {
m_ui->fogPositionDoubleSpinBox->setEnabled(false);
m_ui->fogStrengthDoubleSpinBox->setEnabled(false);
}
else{
} else {
m_ui->fogStrengthDoubleSpinBox->setEnabled(true);
m_ui->fogPositionDoubleSpinBox->setEnabled(true);
}
Expand Down
6 changes: 3 additions & 3 deletions avogadro/renderingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RenderingDialog : public QDialog
Q_OBJECT

public:
RenderingDialog(QWidget *parent, SolidPipeline &pipeline);
RenderingDialog(QWidget* parent, SolidPipeline& pipeline);
~RenderingDialog() override;

bool aoEnabled();
Expand All @@ -44,8 +44,8 @@ protected slots:
void closeButtonClicked();

private:
Ui::RenderingDialog *m_ui;
SolidPipeline &m_solidPipeline;
Ui::RenderingDialog* m_ui;
SolidPipeline& m_solidPipeline;
};

} // End namespace Avogadro
Expand Down
3 changes: 2 additions & 1 deletion avogadro/tooltipfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

ToolTipFilter::ToolTipFilter(QObject* parent)
: QObject(parent)
{}
{
}

bool ToolTipFilter::eventFilter(QObject* object, QEvent* event)
{
Expand Down
8 changes: 4 additions & 4 deletions avogadro/tooltipfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
This source code is released under the 3-Clause BSD License, (see "LICENSE").
******************************************************************************/

#include <QtCore/QObject>
#include <QEvent>
#include <QtCore/QObject>

class ToolTipFilter : public QObject
{
Q_OBJECT
Q_OBJECT

public:
ToolTipFilter(QObject *parent);
ToolTipFilter(QObject* parent);

bool eventFilter(QObject *object, QEvent *event);
bool eventFilter(QObject* object, QEvent* event);
};
8 changes: 2 additions & 6 deletions avogadro/viewfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@

namespace Avogadro {

ViewFactory::ViewFactory()
{
}
ViewFactory::ViewFactory() {}

ViewFactory::~ViewFactory()
{
}
ViewFactory::~ViewFactory() {}

QStringList ViewFactory::views() const
{
Expand Down

0 comments on commit edbc7e1

Please sign in to comment.