Charlie Jiang pushed to branch gsoc-2022-chariri-3 at FreeType / FreeType Demo Programs
Commits:
-
48158cfd
by Charlie Jiang at 2022-09-01T01:12:38+08:00
1 changed file:
Changes:
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | #include "fontfilemanager.hpp"
|
7 | 7 | |
8 | 8 | #include <QCoreApplication>
|
9 | +#include <QGridLayout>
|
|
9 | 10 | #include <QMessageBox>
|
10 | 11 | |
11 | 12 | #include "engine.hpp"
|
... | ... | @@ -54,7 +55,18 @@ FontFileManager::append(QStringList const& newFileNames, bool alertNotExist) |
54 | 55 | if (err)
|
55 | 56 | {
|
56 | 57 | if (alertNotExist)
|
57 | - failedFiles.append(QString("- %1: %2").arg(name).arg(err));
|
|
58 | + {
|
|
59 | + auto errString = FT_Error_String(err);
|
|
60 | + if (!errString)
|
|
61 | + failedFiles.append(QString("- %1: %2")
|
|
62 | + .arg(name)
|
|
63 | + .arg(err));
|
|
64 | + else
|
|
65 | + failedFiles.append(QString("- %1: %2 (%3)")
|
|
66 | + .arg(name)
|
|
67 | + .arg(errString)
|
|
68 | + .arg(err));
|
|
69 | + }
|
|
58 | 70 | continue;
|
59 | 71 | }
|
60 | 72 | |
... | ... | @@ -80,8 +92,17 @@ FontFileManager::append(QStringList const& newFileNames, bool alertNotExist) |
80 | 92 | auto msg = new QMessageBox;
|
81 | 93 | msg->setAttribute(Qt::WA_DeleteOnClose);
|
82 | 94 | msg->setStandardButtons(QMessageBox::Ok);
|
83 | - msg->setWindowTitle(tr("Failed to load some files"));
|
|
84 | - msg->setText(tr("Files failed to load:\n%1").arg(failedFiles.join("\n")));
|
|
95 | + if (failedFiles.size() == 1)
|
|
96 | + {
|
|
97 | + msg->setWindowTitle(tr("Failed to load file"));
|
|
98 | + msg->setText(tr("File failed to load:\n%1").arg(failedFiles.join("\n")));
|
|
99 | + }
|
|
100 | + else
|
|
101 | + {
|
|
102 | + msg->setWindowTitle(tr("Failed to load some files"));
|
|
103 | + msg->setText(tr("Files failed to load:\n%1").arg(failedFiles.join("\n")));
|
|
104 | + }
|
|
105 | +
|
|
85 | 106 | msg->setIcon(QMessageBox::Warning);
|
86 | 107 | msg->setModal(false);
|
87 | 108 | msg->open();
|