forked from fritzing/fritzing-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added probe for getting a FMessageBox log.
- Loading branch information
1 parent
f49a795
commit 33576a4
Showing
6 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************* | ||
Part of the Fritzing project - http://fritzing.org | ||
Copyright (c) 2023 Fritzing GmbH | ||
Fritzing is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Fritzing is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Fritzing. If not, see <http://www.gnu.org/licenses/>. | ||
********************************************************************/ | ||
|
||
#include "FMessageLogProbe.h" | ||
|
||
#include <QJsonArray> | ||
#include <QJsonDocument> | ||
#include <QJsonObject> | ||
|
||
|
||
FMessageLogProbe::FMessageLogProbe() : FProbe("FMessageLog") {} | ||
|
||
QVariant FMessageLogProbe::read() { | ||
QList<QPair<QString, QString>> messages = FMessageBox::getLoggedMessages(); | ||
QJsonArray jsonMessages; | ||
|
||
for (const QPair<QString, QString> &message : messages) { | ||
QJsonObject messageObj; | ||
messageObj["title"] = message.first; | ||
messageObj["text"] = message.second; | ||
jsonMessages.append(messageObj); | ||
} | ||
|
||
QJsonDocument doc(jsonMessages); | ||
QString jsonString = doc.toJson(QJsonDocument::Indented); | ||
return jsonString; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************* | ||
Part of the Fritzing project - http://fritzing.org | ||
Copyright (c) 2023 Fritzing GmbH | ||
Fritzing is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Fritzing is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Fritzing. If not, see <http://www.gnu.org/licenses/>. | ||
********************************************************************/ | ||
|
||
#ifndef FMESSAGELOGPROBE_H | ||
#define FMESSAGELOGPROBE_H | ||
|
||
#include "testing/FProbe.h" | ||
#include "utils/fmessagebox.h" | ||
#include <QVariant> | ||
|
||
class FMessageLogProbe : public FProbe { | ||
public: | ||
FMessageLogProbe(); | ||
QVariant read() override; | ||
void write(QVariant) override {} | ||
}; | ||
|
||
#endif // FMESSAGELOGPROBE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters