Charlie Jiang pushed to branch gsoc-2022-chariri-3 at FreeType / FreeType Demo Programs
Commits:
-
d357f26c
by Charlie Jiang at 2022-08-03T01:10:10+08:00
4 changed files:
- src/ftinspect/engine/fontfilemanager.cpp
- src/ftinspect/engine/fontfilemanager.hpp
- src/ftinspect/maingui.cpp
- src/ftinspect/maingui.hpp
Changes:
... | ... | @@ -5,6 +5,9 @@ |
5 | 5 | |
6 | 6 | #include "fontfilemanager.hpp"
|
7 | 7 | |
8 | +#include <QCoreApplication>
|
|
9 | + |
|
10 | + |
|
8 | 11 | FontFileManager::FontFileManager()
|
9 | 12 | {
|
10 | 13 | fontWatcher_ = new QFileSystemWatcher(this);
|
... | ... | @@ -100,6 +103,18 @@ FontFileManager::timerStart() |
100 | 103 | }
|
101 | 104 | |
102 | 105 | |
106 | +void
|
|
107 | +FontFileManager::loadFromCommandLine()
|
|
108 | +{
|
|
109 | + // TODO: To support more complicated command line, we need to move this away
|
|
110 | + // and use `QCommandLineParser`
|
|
111 | + auto args = QCoreApplication::arguments();
|
|
112 | + if (!args.empty())
|
|
113 | + args.removeFirst();
|
|
114 | + append(args);
|
|
115 | +}
|
|
116 | + |
|
117 | + |
|
103 | 118 | void
|
104 | 119 | FontFileManager::onTimerOrWatcherFire()
|
105 | 120 | {
|
... | ... | @@ -29,6 +29,7 @@ public: |
29 | 29 | QFileInfo& operator[](int index);
|
30 | 30 | void updateWatching(int index);
|
31 | 31 | void timerStart();
|
32 | + void loadFromCommandLine();
|
|
32 | 33 | |
33 | 34 | signals:
|
34 | 35 | void currentFileChanged();
|
... | ... | @@ -28,6 +28,7 @@ MainGUI::MainGUI(Engine* engine) |
28 | 28 | setupDragDrop();
|
29 | 29 | |
30 | 30 | readSettings();
|
31 | + loadCommandLine();
|
|
31 | 32 | |
32 | 33 | setUnifiedTitleAndToolBarOnMac(true);
|
33 | 34 | }
|
... | ... | @@ -142,6 +143,14 @@ MainGUI::openFonts(QStringList const& fileNames) |
142 | 143 | }
|
143 | 144 | |
144 | 145 | |
146 | +void
|
|
147 | +MainGUI::loadCommandLine()
|
|
148 | +{
|
|
149 | + engine_->fontFileManager().loadFromCommandLine();
|
|
150 | + tripletSelector_->repopulateFonts();
|
|
151 | +}
|
|
152 | + |
|
153 | + |
|
145 | 154 | void
|
146 | 155 | MainGUI::onTripletChanged()
|
147 | 156 | {
|
... | ... | @@ -125,6 +125,8 @@ private: |
125 | 125 | |
126 | 126 | void readSettings();
|
127 | 127 | void writeSettings();
|
128 | + |
|
129 | + void loadCommandLine();
|
|
128 | 130 | };
|
129 | 131 | |
130 | 132 |