-
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.
Merge pull request #9 from QuasarApp/sendLocations
added support of location data type
- Loading branch information
Showing
11 changed files
with
182 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>src/qTbotModule/qmldir</file> | ||
<file>src/qTbotModule/qTbot.qml</file> | ||
</qresource> | ||
<qresource prefix="/"/> | ||
<qresource prefix="/qTbotTr"/> | ||
</RCC> |
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,31 @@ | ||
//# | ||
//# Copyright (C) 2023-2023 QuasarApp. | ||
//# Distributed under the GPLv3 software license, see the accompanying | ||
//# Everyone is permitted to copy and distribute verbatim copies | ||
//# of this license document, but changing it is not allowed. | ||
//# | ||
|
||
#include "telegramsendlocation.h" | ||
namespace qTbot { | ||
|
||
TelegramSendLocation::TelegramSendLocation(const QVariant &chatId, | ||
const QString &text, | ||
float latitude, | ||
float longitude, | ||
unsigned long long replyToMessageId | ||
): | ||
TelegramSingleRquest("sendLocation") { | ||
|
||
addArg("chat_id", chatId); | ||
if (text.size()) | ||
addArg("caption", text); | ||
|
||
addArg("latitude", latitude); | ||
addArg("longitude", longitude); | ||
|
||
if (replyToMessageId) { | ||
addArg("reply_to_message_id", replyToMessageId); | ||
} | ||
} | ||
|
||
} |
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,27 @@ | ||
//# | ||
//# Copyright (C) 2023-2023 QuasarApp. | ||
//# Distributed under the GPLv3 software license, see the accompanying | ||
//# Everyone is permitted to copy and distribute verbatim copies | ||
//# of this license document, but changing it is not allowed. | ||
//# | ||
|
||
#ifndef TELEGRAMSENDLOCATION_H | ||
#define TELEGRAMSENDLOCATION_H | ||
|
||
#include "requests/telegramsinglerquest.h" | ||
namespace qTbot { | ||
|
||
/** | ||
* @brief The TelegramSendLocation class sents location data into chat | ||
*/ | ||
class TelegramSendLocation: public TelegramSingleRquest | ||
{ | ||
public: | ||
TelegramSendLocation(const QVariant &chatId, | ||
const QString &text, | ||
float latitude, | ||
float longitude, | ||
unsigned long long replyToMessageId); | ||
}; | ||
} | ||
#endif // TELEGRAMSENDLOCATION_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
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,31 @@ | ||
//# | ||
//# Copyright (C) 2023-2023 QuasarApp. | ||
//# Distributed under the GPLv3 software license, see the accompanying | ||
//# Everyone is permitted to copy and distribute verbatim copies | ||
//# of this license document, but changing it is not allowed. | ||
//# | ||
|
||
#include "telegramlocation.h" | ||
|
||
namespace qTbot { | ||
|
||
TelegramLocation::TelegramLocation() | ||
{ | ||
|
||
} | ||
|
||
TelegramLocation::TelegramLocation(const QJsonObject &jsonObject): | ||
IJsonBasedObject(jsonObject) { | ||
|
||
} | ||
|
||
double TelegramLocation::latitude() const { | ||
return rawJson()["latitude"].toDouble(); | ||
|
||
} | ||
|
||
double TelegramLocation::longitude() const { | ||
return rawJson()["latitude"].toDouble(); | ||
|
||
} | ||
} |
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,43 @@ | ||
//# | ||
//# Copyright (C) 2023-2023 QuasarApp. | ||
//# Distributed under the GPLv3 software license, see the accompanying | ||
//# Everyone is permitted to copy and distribute verbatim copies | ||
//# of this license document, but changing it is not allowed. | ||
//# | ||
|
||
|
||
#ifndef TELEGRAMLOCATION_H | ||
#define TELEGRAMLOCATION_H | ||
|
||
#include <qTbot/ijsonbasedobject.h> | ||
|
||
namespace qTbot { | ||
|
||
/** | ||
* @brief The TelegramLocation class just simple struct with latitude and longitude | ||
*/ | ||
class TelegramLocation: public IJsonBasedObject | ||
{ | ||
public: | ||
TelegramLocation(); | ||
|
||
/** | ||
* @brief Constructs a location object from a JSON object. | ||
* @param jsonObject The JSON object containing photo data. | ||
*/ | ||
TelegramLocation(const QJsonObject &jsonObject); | ||
|
||
/** | ||
* @brief latitude is float value of latitude | ||
* @return float value of latitude | ||
*/ | ||
double latitude() const; | ||
|
||
/** | ||
* @brief longitude is float value of longitude | ||
* @return float value of longitude | ||
*/ | ||
double longitude() const; | ||
}; | ||
} | ||
#endif // TELEGRAMLOCATION_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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.