Skip to content

Commit

Permalink
format all
Browse files Browse the repository at this point in the history
  • Loading branch information
jared committed Jul 11, 2024
1 parent 6f1c003 commit fb87b06
Show file tree
Hide file tree
Showing 21 changed files with 83 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class TaoFrameLessViewPrivate
bool m_isFull = false;
QQuickItem* m_titleItem = nullptr;
};
TaoFrameLessView::TaoFrameLessView(QWindow* parent)
: Super(parent)
, d(new TaoFrameLessViewPrivate)
TaoFrameLessView::TaoFrameLessView(QWindow* parent) : Super(parent), d(new TaoFrameLessViewPrivate)
{
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
setResizeMode(SizeRootObjectToView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void setShadow(HWND handle, bool enabled)
{
if (isCompositionEnabled())
{
static const MARGINS shadow_state[2] { { 0, 0, 0, 0 }, { 1, 1, 1, 1 } };
static const MARGINS shadow_state[2]{ { 0, 0, 0, 0 }, { 1, 1, 1, 1 } };
::DwmExtendFrameIntoClientArea(handle, &shadow_state[enabled]);
}
}
Expand Down Expand Up @@ -134,9 +134,7 @@ class TaoFrameLessViewPrivate
}
}
};
TaoFrameLessView::TaoFrameLessView(QWindow* parent)
: QQuickView(parent)
, d(new TaoFrameLessViewPrivate)
TaoFrameLessView::TaoFrameLessView(QWindow* parent) : QQuickView(parent), d(new TaoFrameLessViewPrivate)
{
// 此处不需要设置flags
// setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint |
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/TaoCommon/src/TaoCommon/Logger/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include <string>

#ifdef Q_OS_WIN
#include <Windows.h>
# include <Windows.h>
#else
#include <cstdio>
# include <cstdio>
#endif

namespace Logger
Expand Down
16 changes: 8 additions & 8 deletions 3rdparty/TaoCommon/src/TaoCommon/Logger/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
namespace Logger
{
#ifdef _DEBUG
#define LOG_DEBUG qDebug() << __FILE__ << __LINE__
#define LOG_INFO qInfo() << __FILE__ << __LINE__
#define LOG_WARN qWarning() << __FILE__ << __LINE__
#define LOG_CRIT qCritical() << __FILE__ << __LINE__
# define LOG_DEBUG qDebug() << __FILE__ << __LINE__
# define LOG_INFO qInfo() << __FILE__ << __LINE__
# define LOG_WARN qWarning() << __FILE__ << __LINE__
# define LOG_CRIT qCritical() << __FILE__ << __LINE__
#else
#define LOG_DEBUG qDebug()
#define LOG_INFO qInfo()
#define LOG_WARN qWarning()
#define LOG_CRIT qCritical()
# define LOG_DEBUG qDebug()
# define LOG_INFO qInfo()
# define LOG_WARN qWarning()
# define LOG_CRIT qCritical()
#endif
// 初始化Log存储。包括创建Log文件夹、删除超过最大数的log(仅初始化时删除,运行过程中不删除)。
// logPath 存储路径
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include "QuickModel/QuickListItemBase.h"

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

QuickListItemBase::~QuickListItemBase() { }
QuickListItemBase::~QuickListItemBase() {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

#include <QDebug>
#include <algorithm>
QuickListModel::QuickListModel(QObject* parent)
: QuickModelBase(parent)
QuickListModel::QuickListModel(QObject* parent) : QuickModelBase(parent)
{
connect(&mSearchTimer, &QTimer::timeout, this, &QuickListModel::onSearch);
mSearchTimer.setInterval(300);
mSearchTimer.setSingleShot(true);
}

QuickListModel::~QuickListModel() { }
QuickListModel::~QuickListModel() {}

void QuickListModel::check(int row, bool checked)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class QuickModelBase : public QAbstractListModel
//[end] update data

public:
virtual void updateCalcInfo() { }
virtual void updateCalcInfo() {}
bool compareDataChanged(const QList<T>& data1, const QList<T>& data2)
{
bool changed = false;
Expand Down Expand Up @@ -86,14 +86,11 @@ class QuickModelBase : public QAbstractListModel
};

template <class T>
QuickModelBase<T>::QuickModelBase(QObject* parent)
: Super(parent)
QuickModelBase<T>::QuickModelBase(QObject* parent) : Super(parent)
{
}
template <class T>
QuickModelBase<T>::QuickModelBase(const QList<T>& datas, QObject* parent)
: Super(parent)
, mDatas(datas)
QuickModelBase<T>::QuickModelBase(const QList<T>& datas, QObject* parent) : Super(parent), mDatas(datas)
{
for (auto it = datas.begin(); it != datas.end(); it++)
{
Expand Down
15 changes: 4 additions & 11 deletions 3rdparty/TaoCommon/src/TaoCommon/QuickTool/QuickTool.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
#include "QuickTool.h"
#include <QGuiApplication>
#include <QQuickItem>
QuickTool::QuickTool(QObject* parent)
: QObject(parent)
{
}
QuickTool::QuickTool(QObject* parent) : QObject(parent) {}

QuickTool::QuickTool(QObject* rootObject, QObject* parent)
: QObject(parent)
, pRootObject(rootObject)
{
}
QuickTool::QuickTool(QObject* rootObject, QObject* parent) : QObject(parent), pRootObject(rootObject) {}

QuickTool::~QuickTool() { }
QuickTool::~QuickTool() {}
void QuickTool::findRootByNode(QObject* nodeObject)
{
pRootObject = nodeObject;
Expand All @@ -37,7 +30,7 @@ QRect QuickTool::getItemGeometryToScene(const QString& targetObjName) const
if (pItem->parentItem())
{
auto pos = pItem->parentItem()->mapToScene(pItem->position());
return QRectF { pos.x(), pos.y(), pItem->width(), pItem->height() }.toRect();
return QRectF{ pos.x(), pos.y(), pItem->width(), pItem->height() }.toRect();
}
else
{
Expand Down
11 changes: 2 additions & 9 deletions 3rdparty/TaoCommon/src/TaoCommon/QuickTree/Model/QuickTreeItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ class TAO_API QuickTreeItem : public QObject
{
Q_OBJECT
public:
explicit QuickTreeItem(QuickTreeItem* parentItem = nullptr)
: m_parentItem(parentItem)
{
}
explicit QuickTreeItem(const QVector<QVariant>& data, QuickTreeItem* parentItem = nullptr)
: m_itemData(data)
, m_parentItem(parentItem)
{
}
explicit QuickTreeItem(QuickTreeItem* parentItem = nullptr) : m_parentItem(parentItem) {}
explicit QuickTreeItem(const QVector<QVariant>& data, QuickTreeItem* parentItem = nullptr) : m_itemData(data), m_parentItem(parentItem) {}

virtual ~QuickTreeItem()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "QuickTreeModel.h"
QuickTreeModel::QuickTreeModel(QObject* parent)
: QAbstractItemModel(parent)
QuickTreeModel::QuickTreeModel(QObject* parent) : QAbstractItemModel(parent)
{
m_rootItem = new QuickTreeItem(nullptr);
QVector<QVariant> datas;
Expand Down
12 changes: 6 additions & 6 deletions 3rdparty/TaoCommon/src/TaoCommon/TaoCommonGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include <QtCore/QtGlobal>

#if !defined(BUILD_STATIC) && !defined(TaoCommon_NO_LIB)
#if defined(TaoCommon_Library)
#define TAO_API Q_DECL_EXPORT
# if defined(TaoCommon_Library)
# define TAO_API Q_DECL_EXPORT
# else
# define TAO_API Q_DECL_IMPORT
# endif
#else
#define TAO_API Q_DECL_IMPORT
#endif
#else
#define TAO_API
# define TAO_API
#endif
5 changes: 1 addition & 4 deletions 3rdparty/TaoCommon/src/TaoCommon/Thread/ThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#include <QThreadPool>
namespace TaoCommon
{
ThreadObject::ThreadObject(const WorkCallback& work)
: m_workCall(work)
{
}
ThreadObject::ThreadObject(const WorkCallback& work) : m_workCall(work) {}
void ThreadObject::run()
{
bool ok = m_workCall();
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/TaoCommon/src/TaoCommon/Thread/ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ class TAO_API ThreadPool : public QObject
void work(const WorkCallback& workCall, const WorkResultCallback& resultCall);

private:
ThreadPool() { }
ThreadPool() {}
};
} // namespace TaoCommon
12 changes: 2 additions & 10 deletions 3rdparty/TaoCommon/src/TaoCommon/Thread/ThreadWorkerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ class ThreadWorker : public QObject
{
Q_OBJECT
public:
ThreadWorker(uint64_t id, const WorkCallback& workCall, QObject* parent = nullptr)
: QObject(parent)
, m_id(id)
, m_workCall(workCall)
{
}
ThreadWorker(uint64_t id, const WorkCallback& workCall, QObject* parent = nullptr) : QObject(parent), m_id(id), m_workCall(workCall) {}

signals:
void workFinished(bool, uint64_t);
Expand Down Expand Up @@ -126,10 +121,7 @@ protected slots:
}

protected:
ThreadController(QObject* parent = nullptr)
: QObject(parent)
{
}
ThreadController(QObject* parent = nullptr) : QObject(parent) {}

private:
uint64_t m_rollId = 0;
Expand Down
7 changes: 2 additions & 5 deletions 3rdparty/TaoCommon/src/TaoCommon/Trans/Trans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
#include <QQuickView>
const static auto cEnglisthStr = u8"English";
const static auto cChineseStr = u8"简体中文";
Trans::Trans(QObject* parent)
: QTranslator(parent)
{
}
Trans::Trans(QObject* parent) : QTranslator(parent) {}

void Trans::beforeUiReady(QQmlContext* ctx, const QString& folder)
{
Expand All @@ -28,7 +25,7 @@ void Trans::beforeUiReady(QQmlContext* ctx, const QString& folder)
qApp->installTranslator(this);
}

void Trans::afterUiReady() { }
void Trans::afterUiReady() {}

QString Trans::translate(const char* context, const char* sourceText, const char* disambiguation, int n) const
{
Expand Down
26 changes: 13 additions & 13 deletions examples/HelloTaoQuick3/HelloTaoQuick3/main.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
#if defined(Q_OS_WIN)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

QGuiApplication app(argc, argv);
QGuiApplication app(argc, argv);

QQmlApplicationEngine engine;

QString importPath = TaoQuickImportPath;
importPath = importPath.replace("\\", "/");
engine.addImportPath(importPath);
engine.rootContext()->setContextProperty("taoQuickImportPath", importPath);
QQmlApplicationEngine engine;

engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
QString importPath = TaoQuickImportPath;
importPath = importPath.replace("\\", "/");
engine.addImportPath(importPath);
engine.rootContext()->setContextProperty("taoQuickImportPath", importPath);

return app.exec();
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;

return app.exec();
}
5 changes: 2 additions & 3 deletions examples/TaoQuickShow/Src/AppInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include "Ver-u8.h"
#include <QQmlContext>
#include <QSysInfo>
AppInfo::AppInfo(QObject* parent)
: QObject(parent)
AppInfo::AppInfo(QObject* parent) : QObject(parent)
{
m_appName = VER_PRODUCTNAME_STR;
m_appVersion = TaoVer;
Expand All @@ -28,4 +27,4 @@ void AppInfo::afterUiReady()
// qWarning() << json;
}

AppInfo::~AppInfo() { }
AppInfo::~AppInfo() {}
5 changes: 2 additions & 3 deletions examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddItem.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "DeviceAddItem.h"
#include <QHostAddress>
DeviceAddItem::DeviceAddItem(QObject* parent)
: QuickListItemBase(parent)
DeviceAddItem::DeviceAddItem(QObject* parent) : QuickListItemBase(parent)
{
connect(this, &DeviceAddItem::addressChanged, this, [this]() { m_ipv4Address = QHostAddress(address()).toIPv4Address(); });
}

DeviceAddItem::~DeviceAddItem() { }
DeviceAddItem::~DeviceAddItem() {}
bool DeviceAddItem::match(const QString& key)
{
if (key.isEmpty())
Expand Down
6 changes: 2 additions & 4 deletions examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ class DeviceAddModelPrivate
{
public:
std::default_random_engine randomEngine;
std::uniform_int_distribution<uint32_t> u65535 { 0, 0xffffffff };
std::uniform_int_distribution<uint32_t> u65535{ 0, 0xffffffff };
};
DeviceAddModel::DeviceAddModel(QObject* parent)
: QuickListModel(parent)
, d(new DeviceAddModelPrivate)
DeviceAddModel::DeviceAddModel(QObject* parent) : QuickListModel(parent), d(new DeviceAddModelPrivate)
{
set_headerRoles(sHeaderRoles);
set_sortRole("name");
Expand Down
6 changes: 3 additions & 3 deletions examples/TaoQuickShow/Src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "Frameless/TaoFrameLessView.h"

#ifndef TAODEBUG
#include "Logger/Logger.h"
# include "Logger/Logger.h"
#endif

#include "QuickTool/QuickTool.h"
Expand All @@ -20,9 +20,9 @@ static void prepareApp()
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
# endif
#endif
QCoreApplication::setOrganizationName("JaredTao");
QCoreApplication::setOrganizationDomain("https://jaredtao.github.io");
Expand Down
Loading

0 comments on commit fb87b06

Please sign in to comment.