Skip to content

Commit c7065ee

Browse files
committed
Merge remote-tracking branch 'origin/master' into qt6-category
2 parents 002cf74 + b300926 commit c7065ee

File tree

113 files changed

+14132
-13949
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+14132
-13949
lines changed

.clang-format

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
# We'll use defaults from the LLVM style, but with 4 columns indentation.
3+
BasedOnStyle: LLVM
4+
IndentWidth: 2
5+
---
6+
Language: Cpp
7+
DeriveLineEnding: false
8+
UseCRLF: true
9+
DerivePointerAlignment: false
10+
PointerAlignment: Left
11+
AlignConsecutiveAssignments: true
12+
AllowShortFunctionsOnASingleLine: Inline
13+
AllowShortIfStatementsOnASingleLine: Never
14+
AllowShortLambdasOnASingleLine: Empty
15+
AlwaysBreakTemplateDeclarations: Yes
16+
AccessModifierOffset: -2
17+
AlignTrailingComments: true
18+
SpacesBeforeTrailingComments: 2
19+
NamespaceIndentation: Inner
20+
MaxEmptyLinesToKeep: 1
21+
BreakBeforeBraces: Custom
22+
BraceWrapping:
23+
AfterCaseLabel: false
24+
AfterClass: true
25+
AfterControlStatement: false
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: true
29+
AfterStruct: true
30+
AfterUnion: true
31+
AfterExternBlock: true
32+
BeforeCatch: false
33+
BeforeElse: false
34+
BeforeLambdaBody: false
35+
BeforeWhile: false
36+
IndentBraces: false
37+
SplitEmptyFunction: false
38+
SplitEmptyRecord: false
39+
SplitEmptyNamespace: true
40+
ColumnLimit: 88
41+
ForEachMacros: ['Q_FOREACH', 'foreach']

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
218607a6ce4d41112bd3995ba319255aec3c5c2e

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.cpp text eol=crlf
7+
*.h text eol=crlf

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build UIBase
2+
on:
3+
push:
4+
branches: master
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
jobs:
8+
build:
9+
runs-on: windows-2022
10+
steps:
11+
- name: Build UI Base
12+
uses: ModOrganizer2/build-with-mob-action@master
13+
with:
14+
mo2-third-parties: fmt gtest spdlog boost
15+
mo2-dependencies: cmake_common

.github/workflows/linting.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Lint UIBase
2+
on:
3+
push:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Run clang-format
12+
uses: jidicula/[email protected]
13+
with:
14+
clang-format-version: "15"
15+
check-path: "."

src/delayedfilewriter.cpp

Lines changed: 49 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,49 @@
1-
#include "delayedfilewriter.h"
2-
#include "log.h"
3-
4-
5-
using namespace MOBase;
6-
7-
8-
DelayedFileWriterBase::DelayedFileWriterBase(int delay)
9-
: m_TimerDelay(delay)
10-
, m_Timer()
11-
{
12-
QObject::connect(&m_Timer, &QTimer::timeout, this, &DelayedFileWriter::timerExpired);
13-
m_Timer.setSingleShot(true);
14-
}
15-
16-
DelayedFileWriterBase::~DelayedFileWriterBase()
17-
{
18-
if (m_Timer.isActive()) {
19-
log::error("delayed file save timer active at shutdown");
20-
}
21-
}
22-
23-
void DelayedFileWriterBase::write()
24-
{
25-
m_Timer.start(m_TimerDelay);
26-
}
27-
28-
void DelayedFileWriterBase::cancel()
29-
{
30-
m_Timer.stop();
31-
}
32-
33-
void DelayedFileWriterBase::writeImmediately(bool ifOnTimer)
34-
{
35-
if (!ifOnTimer || m_Timer.isActive()) {
36-
m_Timer.stop();
37-
doWrite();
38-
}
39-
}
40-
41-
void DelayedFileWriterBase::timerExpired()
42-
{
43-
doWrite();
44-
}
45-
46-
47-
48-
DelayedFileWriter::DelayedFileWriter(DelayedFileWriter::WriterFunc func
49-
, int delay)
50-
: DelayedFileWriterBase(delay)
51-
, m_Func(func)
52-
{
53-
}
54-
55-
void DelayedFileWriter::doWrite()
56-
{
57-
m_Func();
58-
}
1+
#include "delayedfilewriter.h"
2+
#include "log.h"
3+
4+
using namespace MOBase;
5+
6+
DelayedFileWriterBase::DelayedFileWriterBase(int delay) : m_TimerDelay(delay), m_Timer()
7+
{
8+
QObject::connect(&m_Timer, &QTimer::timeout, this, &DelayedFileWriter::timerExpired);
9+
m_Timer.setSingleShot(true);
10+
}
11+
12+
DelayedFileWriterBase::~DelayedFileWriterBase()
13+
{
14+
if (m_Timer.isActive()) {
15+
log::error("delayed file save timer active at shutdown");
16+
}
17+
}
18+
19+
void DelayedFileWriterBase::write()
20+
{
21+
m_Timer.start(m_TimerDelay);
22+
}
23+
24+
void DelayedFileWriterBase::cancel()
25+
{
26+
m_Timer.stop();
27+
}
28+
29+
void DelayedFileWriterBase::writeImmediately(bool ifOnTimer)
30+
{
31+
if (!ifOnTimer || m_Timer.isActive()) {
32+
m_Timer.stop();
33+
doWrite();
34+
}
35+
}
36+
37+
void DelayedFileWriterBase::timerExpired()
38+
{
39+
doWrite();
40+
}
41+
42+
DelayedFileWriter::DelayedFileWriter(DelayedFileWriter::WriterFunc func, int delay)
43+
: DelayedFileWriterBase(delay), m_Func(func)
44+
{}
45+
46+
void DelayedFileWriter::doWrite()
47+
{
48+
m_Func();
49+
}

src/delayedfilewriter.h

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,74 @@
1-
#ifndef DELAYEDFILEWRITER_H
2-
#define DELAYEDFILEWRITER_H
3-
4-
5-
#include "dllimport.h"
6-
#include <QString>
7-
#include <QTimer>
8-
#include <functional>
9-
10-
11-
namespace MOBase {
12-
13-
/**
14-
* The purpose of this class is to aggregate changes to a file before writing it out
15-
*/
16-
class QDLLEXPORT DelayedFileWriterBase : public QObject {
17-
18-
Q_OBJECT
19-
20-
public:
21-
/**
22-
* @brief constructor
23-
* @param fileName
24-
* @param delay delay (in milliseconds) before we call the actual write function
25-
*/
26-
DelayedFileWriterBase(int delay = 200);
27-
~DelayedFileWriterBase();
28-
29-
public slots:
30-
/**
31-
* @brief write with delay
32-
*/
33-
void write();
34-
35-
/**
36-
* @brief cancel a scheduled write (does nothing if no write is scheduled)
37-
*/
38-
void cancel();
39-
40-
/**
41-
* @brief write immediately without waiting for the timer to expire
42-
* @param ifOnTimer only write if the timer is running
43-
*/
44-
void writeImmediately(bool ifOnTimer);
45-
46-
private slots:
47-
void timerExpired();
48-
49-
private:
50-
virtual void doWrite() = 0;
51-
52-
private:
53-
int m_TimerDelay;
54-
QTimer m_Timer;
55-
};
56-
57-
58-
class QDLLEXPORT DelayedFileWriter : public DelayedFileWriterBase {
59-
public:
60-
typedef std::function<void()> WriterFunc;
61-
public:
62-
DelayedFileWriter(WriterFunc func, int delay = 200);
63-
private:
64-
void doWrite();
65-
private:
66-
WriterFunc m_Func;
67-
};
68-
69-
}
70-
71-
#endif // DELAYEDFILEWRITER_H
1+
#ifndef DELAYEDFILEWRITER_H
2+
#define DELAYEDFILEWRITER_H
3+
4+
#include "dllimport.h"
5+
#include <QString>
6+
#include <QTimer>
7+
#include <functional>
8+
9+
namespace MOBase
10+
{
11+
12+
/**
13+
* The purpose of this class is to aggregate changes to a file before writing it out
14+
*/
15+
class QDLLEXPORT DelayedFileWriterBase : public QObject
16+
{
17+
18+
Q_OBJECT
19+
20+
public:
21+
/**
22+
* @brief constructor
23+
* @param fileName
24+
* @param delay delay (in milliseconds) before we call the actual write function
25+
*/
26+
DelayedFileWriterBase(int delay = 200);
27+
~DelayedFileWriterBase();
28+
29+
public slots:
30+
/**
31+
* @brief write with delay
32+
*/
33+
void write();
34+
35+
/**
36+
* @brief cancel a scheduled write (does nothing if no write is scheduled)
37+
*/
38+
void cancel();
39+
40+
/**
41+
* @brief write immediately without waiting for the timer to expire
42+
* @param ifOnTimer only write if the timer is running
43+
*/
44+
void writeImmediately(bool ifOnTimer);
45+
46+
private slots:
47+
void timerExpired();
48+
49+
private:
50+
virtual void doWrite() = 0;
51+
52+
private:
53+
int m_TimerDelay;
54+
QTimer m_Timer;
55+
};
56+
57+
class QDLLEXPORT DelayedFileWriter : public DelayedFileWriterBase
58+
{
59+
public:
60+
typedef std::function<void()> WriterFunc;
61+
62+
public:
63+
DelayedFileWriter(WriterFunc func, int delay = 200);
64+
65+
private:
66+
void doWrite();
67+
68+
private:
69+
WriterFunc m_Func;
70+
};
71+
72+
} // namespace MOBase
73+
74+
#endif // DELAYEDFILEWRITER_H

src/diagnosisreport.cpp

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
/*
2-
Mod Organizer shared UI functionality
3-
4-
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
5-
6-
This library is free software; you can redistribute it and/or
7-
modify it under the terms of the GNU Lesser General Public
8-
License as published by the Free Software Foundation; either
9-
version 3 of the License, or (at your option) any later version.
10-
11-
This library is distributed in the hope that it will be useful,
12-
but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-
Lesser General Public License for more details.
15-
16-
You should have received a copy of the GNU Lesser General Public
17-
License along with this library; if not, write to the Free Software
18-
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19-
*/
20-
21-
#include "diagnosisreport.h"
22-
23-
namespace MOBase {
24-
} // namespace MOBase
1+
/*
2+
Mod Organizer shared UI functionality
3+
4+
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 3 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#include "diagnosisreport.h"
22+
23+
namespace MOBase
24+
{
25+
} // namespace MOBase

0 commit comments

Comments
 (0)