Skip to content

Commit b480ede

Browse files
committed
Update lyric tool
1 parent 4680dbc commit b480ede

20 files changed

+193
-33
lines changed

src/plugins/iemgr/core/wizardmanager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ namespace IEMgr {
7676
return true;
7777
}
7878

79+
IWizard *WizardManager::wizard(const QString &id) const {
80+
Q_D(const WizardManager);
81+
return d->importWizards.value(id);
82+
}
83+
7984
QList<IWizard *> WizardManager::wizards() const {
8085
Q_D(const WizardManager);
8186
return d->importWizards.values_qlist();

src/plugins/iemgr/core/wizardmanager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace IEMgr {
2323
bool addWizard(IWizard *factory);
2424
bool removeWizard(IWizard *factory);
2525
bool removeWizard(const QString &id);
26+
IWizard *wizard(const QString &id) const;
2627
QList<IWizard *> wizards() const;
2728
void clearWizards();
2829

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
11
#include "charsetanalyzer.h"
2+
#include "charsetanalyzer_p.h"
23

3-
#include <qrandom.h>
4+
#include <QtCore/QRandomGenerator>
45

56
namespace LyricTool {
7+
8+
CharsetAnalyzerPrivate::CharsetAnalyzerPrivate() {
9+
}
10+
11+
void CharsetAnalyzerPrivate::init() {
12+
}
13+
614
CharsetAnalyzer::CharsetAnalyzer(const QString &id, QObject *parent)
7-
: ILanguageAnalyzer(id, parent) {
15+
: CharsetAnalyzer(*new CharsetAnalyzerPrivate(), id, parent) {
816
}
917

1018
void CharsetAnalyzer::loadDict() {
1119
}
1220

1321
bool CharsetAnalyzer::contains(QChar c) const {
14-
return m_charset.contains(c);
22+
Q_D(const CharsetAnalyzer);
23+
return d->charset.contains(c);
1524
}
1625

1726
QString CharsetAnalyzer::randString() const {
18-
if (m_charset.isEmpty()) {
19-
return "";
27+
Q_D(const CharsetAnalyzer);
28+
if (d->charset.isEmpty()) {
29+
return {};
2030
}
2131

22-
const int randomIndex = QRandomGenerator::global()->bounded(m_charset.size());
23-
auto it = m_charset.begin();
32+
const int randomIndex = QRandomGenerator::global()->bounded(d->charset.size());
33+
auto it = d->charset.begin();
2434
std::advance(it, randomIndex);
25-
2635
return *it;
2736
}
2837

38+
CharsetAnalyzer::CharsetAnalyzer(CharsetAnalyzerPrivate &d, const QString &id, QObject *parent)
39+
: ILanguageAnalyzer(d, id, parent) {
40+
d.init();
41+
}
42+
2943
}

src/plugins/lyrictool/core/lang/charsetanalyzer.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66

77
namespace LyricTool {
88

9-
class LYRICTOOL_EXPORT CharsetAnalyzer : public LyricTool::ILanguageAnalyzer {
9+
class CharsetAnalyzerPrivate;
10+
11+
class LYRICTOOL_EXPORT CharsetAnalyzer : public ILanguageAnalyzer {
1012
Q_OBJECT
13+
Q_DECLARE_PRIVATE(CharsetAnalyzer)
1114
public:
1215
CharsetAnalyzer(const QString &id, QObject *parent = nullptr);
1316

1417
virtual void loadDict();
1518

1619
bool contains(QChar c) const override;
17-
1820
QString randString() const override;
1921

2022
protected:
21-
QSet<QChar> m_charset;
23+
CharsetAnalyzer(CharsetAnalyzerPrivate &d, const QString &id, QObject *parent = nullptr);
2224
};
2325

2426
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef CHARSETANALYZER_P_H
2+
#define CHARSETANALYZER_P_H
3+
4+
#include <QtCore/QSet>
5+
6+
#include <lyrictool/charsetanalyzer.h>
7+
#include <lyrictool/private/ilanguageanalyzer_p.h>
8+
9+
namespace LyricTool {
10+
11+
class CharsetAnalyzerPrivate : public ILanguageAnalyzerPrivate {
12+
Q_DECLARE_PUBLIC(CharsetAnalyzer)
13+
public:
14+
CharsetAnalyzerPrivate();
15+
16+
void init();
17+
18+
QSet<QChar> charset;
19+
};
20+
21+
}
22+
23+
#endif // CHARSETANALYZER_P_H

src/plugins/lyrictool/core/lang/dictanalyzer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace LyricTool {
3030
int depth = 0;
3131
};
3232

33-
class LYRICTOOL_EXPORT DictAnalyzer : public LyricTool::ILanguageAnalyzer {
33+
class LYRICTOOL_EXPORT DictAnalyzer : public ILanguageAnalyzer {
3434
Q_OBJECT
3535
public:
3636
DictAnalyzer(const QString &id, QObject *parent = nullptr);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#ifndef DICTANALYZER_P_H
2+
#define DICTANALYZER_P_H
3+
4+
5+
#endif // DICTANALYZER_P_H
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#ifndef MULTICHARANALYZER_P_H
2+
#define MULTICHARANALYZER_P_H
3+
4+
5+
#endif // MULTICHARANALYZER_P_H

0 commit comments

Comments
 (0)