mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
clean: fix some issues found by the code analysis of Visual Studio
Some checks failed
SonarCloud / Build and analyze (push) Has been cancelled
Some checks failed
SonarCloud / Build and analyze (push) Has been cancelled
This commit is contained in:
parent
0f71f32ad4
commit
c5d682c993
|
@ -492,7 +492,7 @@ struct WebSite
|
||||||
QString id, name, url;
|
QString id, name, url;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
QString iconFilename;
|
QString iconFilename;
|
||||||
bool inside_iframe;
|
bool inside_iframe = false;
|
||||||
|
|
||||||
WebSite():
|
WebSite():
|
||||||
enabled( false )
|
enabled( false )
|
||||||
|
@ -698,7 +698,7 @@ struct Transliteration
|
||||||
|
|
||||||
struct Lingua
|
struct Lingua
|
||||||
{
|
{
|
||||||
bool enable;
|
bool enable = false;
|
||||||
QString languageCodes;
|
QString languageCodes;
|
||||||
|
|
||||||
bool operator==( Lingua const & other ) const
|
bool operator==( Lingua const & other ) const
|
||||||
|
@ -737,13 +737,16 @@ struct Forvo
|
||||||
struct Program
|
struct Program
|
||||||
{
|
{
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
// NOTE: the value of this enum is used for config
|
||||||
enum Type {
|
enum Type {
|
||||||
Audio,
|
Invalid = -1, // Init value
|
||||||
PlainText,
|
Audio = 0,
|
||||||
Html,
|
PlainText = 1,
|
||||||
PrefixMatch,
|
Html = 2,
|
||||||
MaxTypeValue
|
PrefixMatch = 3,
|
||||||
} type;
|
MaxTypeValue = 4
|
||||||
|
};
|
||||||
|
Type type = Invalid;
|
||||||
QString id, name, commandLine;
|
QString id, name, commandLine;
|
||||||
QString iconFilename;
|
QString iconFilename;
|
||||||
|
|
||||||
|
@ -892,7 +895,7 @@ struct Class
|
||||||
QString articleSavePath; // Path to save articles
|
QString articleSavePath; // Path to save articles
|
||||||
|
|
||||||
bool pinPopupWindow; // Last pin status
|
bool pinPopupWindow; // Last pin status
|
||||||
bool popupWindowAlwaysOnTop; // Last status of pinned popup window
|
bool popupWindowAlwaysOnTop = false; // Last status of pinned popup window
|
||||||
|
|
||||||
QByteArray mainWindowState; // Binary state saved by QMainWindow
|
QByteArray mainWindowState; // Binary state saved by QMainWindow
|
||||||
QByteArray mainWindowGeometry; // Geometry saved by QMainWindow
|
QByteArray mainWindowGeometry; // Geometry saved by QMainWindow
|
||||||
|
@ -929,7 +932,7 @@ struct Class
|
||||||
Group const * getGroup( unsigned id ) const;
|
Group const * getGroup( unsigned id ) const;
|
||||||
//disable tts dictionary. does not need to save to persistent file
|
//disable tts dictionary. does not need to save to persistent file
|
||||||
bool notts = false;
|
bool notts = false;
|
||||||
bool resetState;
|
bool resetState = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Configuration-specific events. Some parts of the program need to react
|
/// Configuration-specific events. Some parts of the program need to react
|
||||||
|
|
|
@ -45,9 +45,9 @@ DEF_EX( exCorruptedChainData, "Corrupted chain data in the leaf of a btree encou
|
||||||
struct WordArticleLink
|
struct WordArticleLink
|
||||||
{
|
{
|
||||||
string word, prefix; // in utf8
|
string word, prefix; // in utf8
|
||||||
uint32_t articleOffset;
|
uint32_t articleOffset = 0;
|
||||||
|
|
||||||
WordArticleLink() {}
|
WordArticleLink() = default;
|
||||||
|
|
||||||
WordArticleLink( string const & word_, uint32_t articleOffset_, string const & prefix_ = string() ):
|
WordArticleLink( string const & word_, uint32_t articleOffset_, string const & prefix_ = string() ):
|
||||||
word( word_ ),
|
word( word_ ),
|
||||||
|
|
|
@ -102,8 +102,7 @@ string convert( string const & in,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Fall-through
|
[[fallthrough]];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
inConverted.push_back( i );
|
inConverted.push_back( i );
|
||||||
afterEol = false;
|
afterEol = false;
|
||||||
|
|
|
@ -47,10 +47,11 @@ struct HotkeyStruct
|
||||||
HotkeyStruct() = default;
|
HotkeyStruct() = default;
|
||||||
HotkeyStruct( quint32 key, quint32 key2, quint32 modifier, int handle, int id );
|
HotkeyStruct( quint32 key, quint32 key2, quint32 modifier, int handle, int id );
|
||||||
|
|
||||||
quint32 key, key2;
|
quint32 key = 0;
|
||||||
quint32 modifier;
|
quint32 key2 = 0;
|
||||||
int handle;
|
quint32 modifier = 0;
|
||||||
int id;
|
int handle = 0;
|
||||||
|
int id = 0;
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
EventHotKeyRef hkRef = 0;
|
EventHotKeyRef hkRef = 0;
|
||||||
EventHotKeyRef hkRef2 = 0;
|
EventHotKeyRef hkRef2 = 0;
|
||||||
|
|
|
@ -341,8 +341,11 @@ int main( int argc, char ** argv )
|
||||||
// attach the new console to this application's process
|
// attach the new console to this application's process
|
||||||
if ( AttachConsole( ATTACH_PARENT_PROCESS ) ) {
|
if ( AttachConsole( ATTACH_PARENT_PROCESS ) ) {
|
||||||
// reopen the std I/O streams to redirect I/O to the new console
|
// reopen the std I/O streams to redirect I/O to the new console
|
||||||
freopen( "CON", "w", stdout );
|
auto ret1 = freopen( "CON", "w", stdout );
|
||||||
freopen( "CON", "w", stderr );
|
auto ret2 = freopen( "CON", "w", stderr );
|
||||||
|
if ( ret1 == nullptr || ret2 == nullptr ) {
|
||||||
|
qDebug() << "Attaching console stdout or stderr failed";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qputenv( "QT_QPA_PLATFORM", "windows:darkmode=1" );
|
qputenv( "QT_QPA_PLATFORM", "windows:darkmode=1" );
|
||||||
|
|
|
@ -84,13 +84,13 @@ private slots:
|
||||||
private:
|
private:
|
||||||
virtual bool eventFilter( QObject *, QEvent * );
|
virtual bool eventFilter( QObject *, QEvent * );
|
||||||
|
|
||||||
Config::Class * m_cfg;
|
Config::Class * m_cfg = nullptr;
|
||||||
QTreeView * m_favoritesTree;
|
QTreeView * m_favoritesTree = nullptr;
|
||||||
QMenu * m_favoritesMenu;
|
QMenu * m_favoritesMenu = nullptr;
|
||||||
QAction * m_deleteSelectedAction;
|
QAction * m_deleteSelectedAction = nullptr;
|
||||||
QAction * m_separator;
|
QAction * m_separator = nullptr;
|
||||||
QAction * m_copySelectedToClipboard;
|
QAction * m_copySelectedToClipboard = nullptr;
|
||||||
QAction * m_addFolder;
|
QAction * m_addFolder = nullptr;
|
||||||
|
|
||||||
QWidget favoritesPaneTitleBar;
|
QWidget favoritesPaneTitleBar;
|
||||||
QHBoxLayout favoritesPaneTitleBarLayout;
|
QHBoxLayout favoritesPaneTitleBarLayout;
|
||||||
|
|
|
@ -53,13 +53,13 @@ private slots:
|
||||||
private:
|
private:
|
||||||
virtual bool eventFilter( QObject *, QEvent * );
|
virtual bool eventFilter( QObject *, QEvent * );
|
||||||
|
|
||||||
Config::Class * m_cfg;
|
Config::Class * m_cfg = nullptr;
|
||||||
History * m_history;
|
History * m_history = nullptr;
|
||||||
QListView * m_historyList;
|
QListView * m_historyList = nullptr;
|
||||||
QMenu * m_historyMenu;
|
QMenu * m_historyMenu = nullptr;
|
||||||
QAction * m_deleteSelectedAction;
|
QAction * m_deleteSelectedAction = nullptr;
|
||||||
QAction * m_separator;
|
QAction * m_separator = nullptr;
|
||||||
QAction * m_copySelectedToClipboard;
|
QAction * m_copySelectedToClipboard = nullptr;
|
||||||
|
|
||||||
QWidget historyPaneTitleBar;
|
QWidget historyPaneTitleBar;
|
||||||
QHBoxLayout historyPaneTitleBarLayout;
|
QHBoxLayout historyPaneTitleBarLayout;
|
||||||
|
|
Loading…
Reference in a new issue