Skip to content

Commit

Permalink
release: 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapatas committed Oct 21, 2021
2 parents af0b8f5 + d7b4316 commit b46bf46
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 51 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [0.0.1] - 2021-10-21

### Added

- Line numbers in editors.
- Header and banner in NSIS installer.
- Save icon in profile save button.
- Label on format drop-down of editors.

### Fixed

- Crash when subscribing to an invalid topic.
- Package description for `.deb` installer
- Overwrite snippet context option appearing for folders.

## [0.0.0] - 2021-09-18

### Added
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.17)

project(transmitron)

set(PROGRAM_DESCRIPTION "Open source MQTT Client for desktop. Flexible, native, and cross-platform")
set(PROGRAM_DESCRIPTION "Open source MQTT Client for desktop. Flexible, native, and cross-platform.")

set(TRANSMITRON_VERSION_MAJOR 0)
set(TRANSMITRON_VERSION_MINOR 0)
set(TRANSMITRON_VERSION_PATCH 0)
set(TRANSMITRON_VERSION_PATCH 1)
set(TRANSMITRON_VERSION_POSTFIX "")

string(CONCAT TRANSMITRON_VERSION
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<a
href="https://github.com/Rapatas/transmitron/releases"><img
alt="Release version"
src="https://img.shields.io/github/v/release/Rapatas/transmitron?logo=github&style=for-the-badge&color=419898"
src="https://img.shields.io/github/v/release/Rapatas/transmitron?logo=github&style=for-the-badge"
></a>
<a
href="https://drone.rapatas.com/Rapatas/transmitron/"><img
Expand All @@ -36,14 +36,15 @@
<a
href="https://github.com/Rapatas/transmitron/blob/develop/LICENSE.txt"><img
alt="License: GPL-3"
src="https://img.shields.io/github/license/Rapatas/transmitron?style=for-the-badge&color=419898"
src="https://img.shields.io/github/license/Rapatas/transmitron?style=for-the-badge"
></a>
</p>
<hr>
<p align="center">
<img src="https://i.imgur.com/JUEBvBS.png">
</p>


## Features

- **Profiles.** Store connections to brokers.
Expand Down
23 changes: 20 additions & 3 deletions cmake/cpack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(CPACK_PACKAGE_CHECKSUM "SHA256")
set(CPACK_PACKAGE_CONTACT "Andy Rapatas <https://github.com/rapatas>")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/rapatas/transmitron")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DESCRIPTION "Normal description")
set(CPACK_PACKAGE_DESCRIPTION "${PROGRAM_DESCRIPTION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")

Expand All @@ -52,7 +52,7 @@ string(CONCAT CPACK_PACKAGE_FILE_NAME
# Source
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
set(
CPACK_SOURCE_IGNORE_FILES
CPACK_SOURCE_IGNORE_FILES
".drone.yml"
".cache"
".gitignore"
Expand All @@ -65,6 +65,8 @@ set(

# NSIS (Windows .exe installer)
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/images/transmitron.ico")
set(CPACK_NSIS_MUI_HEADERIMAGE "${CMAKE_SOURCE_DIR}/resources/images/nsis/header.bmp")
set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${CMAKE_SOURCE_DIR}/resources/images/nsis/welcomefinish.bmp")
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin/transmitron.exe")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
Expand All @@ -87,6 +89,21 @@ set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "\
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk2.0-dev")
set(CPACK_DEBIAN_PACKAGE_SECTION "internet")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Hello")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "## Features:
Profiles: Store connections to brokers.
Multiple Connections: Connect to multiple Profiles at the same time using tabs.
Snippets: Store messages in a nested folder structure, ready to publish.
Folding: For messages with nested data.
Syntax highlight, detection & formatting: Supports JSON and XML.
Flexible: Resize, drag, detach or hide each sidebar separately.
Layouts: Store sidebar locations and sizes.
XDG BaseDir: Respects the XDG Base Directory specification.
Native UI: Using wxWidgets to integrate seamlessly with your desktop theme.
Mute / Solo: Hide or isolate messages for each subscription.
History Filter: Limit history using search terms.
Cross-Platform: Built for Windows and Linux.
"
)

include(CPack)
Binary file added resources/images/nsis/header.bmp
Binary file not shown.
Binary file added resources/images/nsis/welcomefinish.bmp
Binary file not shown.
94 changes: 74 additions & 20 deletions src/MQTT/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,43 +314,97 @@ void Client::onSuccessUnsubscribe(const mqtt::token& tok)

void Client::onFailureConnect(const mqtt::token& tok)
{
mLogger->warn(
"Connection attempt failed: {}",
mReturnCodes.at(tok.get_return_code())
);
const auto code = tok.get_return_code();
const auto codeIt = mReturnCodes.find(code);
if (codeIt != std::end(mReturnCodes))
{
mLogger->warn("Connection attempt failed: {}", codeIt->second);
}
else
{
mLogger->warn("Connection attempt failed: {}", code);
}
reconnect();
}

void Client::onFailureDisconnect(const mqtt::token& tok)
{
mLogger->warn(
"Disconnection attempt failed: {}",
mReturnCodes.at(tok.get_return_code())
);
const auto code = tok.get_return_code();
const auto codeIt = mReturnCodes.find(code);
if (codeIt != std::end(mReturnCodes))
{
mLogger->warn("Disconnection attempt failed: {}", codeIt->second);
}
else
{
mLogger->warn("Disconnection attempt failed: {}", code);
}
}

void Client::onFailurePublish(const mqtt::token& tok)
{
mLogger->warn(
"Publishing attempt failed: {}",
mReturnCodes.at(tok.get_return_code())
);
const auto code = tok.get_return_code();
const auto codeIt = mReturnCodes.find(code);
if (codeIt != std::end(mReturnCodes))
{
mLogger->warn("Publishing attempt failed: {}", codeIt->second);
}
else
{
mLogger->warn("Publishing attempt failed: {}", code);
}
}

void Client::onFailureSubscribe(const mqtt::token& tok)
{
mLogger->warn(
"Subscription attempt failed: {}",
mReturnCodes.at(tok.get_return_code())
);
const auto size = tok.get_topics()->size();

if (size == 0)
{
mLogger->warn("Subscription attempt failed: Response empty");
return;
}

const auto topic = (*tok.get_topics())[size - 1];

for (
auto subIt = std::begin(mSubscriptions);
subIt != std::end(mSubscriptions);
++subIt
) {
if (Client::match(subIt->second->getFilter(), topic))
{
subIt->second->onUnsubscribed();
mSubscriptions.erase(subIt);
break;
}
}

const auto code = tok.get_return_code();
const auto codeIt = mReturnCodes.find(code);

if (codeIt != std::end(mReturnCodes))
{
mLogger->warn("Subscription attempt failed: {}", codeIt->second);
}
else
{
mLogger->warn("Subscription attempt failed: {}", code);
}
}

void Client::onFailureUnsubscribe(const mqtt::token& tok)
{
mLogger->warn(
"Unsubscription attempt failed: {}",
mReturnCodes.at(tok.get_return_code())
);
const auto code = tok.get_return_code();
const auto codeIt = mReturnCodes.find(code);
if (codeIt != std::end(mReturnCodes))
{
mLogger->warn("Unsubscription attempt failed: {}", codeIt->second);
}
else
{
mLogger->warn("Unsubscription attempt failed: {}", code);
}
}

// mqtt::iaction_listener interface }
Expand Down
31 changes: 24 additions & 7 deletions src/MQTT/Client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,30 @@ class Client :

const std::map<int, std::string> mReturnCodes
{
{ 0, "Connection accepted" },
{ 1, "Unacceptable protocol version" },
{ 2, "Identifier rejected" },
{ 3, "Service unavailable" },
{ 4, "Bad user name or password" },
{ 5, "Not authorized" },
{ -1, "Connection timeout" }
{ 0, "Connection accepted" },
{ 1, "Unacceptable protocol version" },
{ 2, "Identifier rejected" },
{ 3, "Service unavailable" },
{ 4, "Bad user name or password" },
{ 5, "Not authorized" },
{ -1, "Connection timeout" },
{ -2, "Persistence error" },
{ -3, "Disconnected" },
{ -4, "Max messages inflight" },
{ -5, "Bad utf8 string" },
{ -6, "Null parameter" },
{ -7, "Topicname truncated" },
{ -8, "Bad structure" },
{ -9, "Bad QOS" },
{ -10, "No more MsgIds" },
{ -11, "Operation incomplete" },
{ -12, "Max buffered messages" },
{ -13, "Ssl not supported" },
{ -14, "Bad protocol" },
{ -15, "Bad MQTT option" },
{ -16, "Wrong MQTT version" },
{ -17, "Zero length will topic" },
{ -18, "Command ignored" },
};

std::shared_ptr<spdlog::logger> mLogger;
Expand Down
17 changes: 10 additions & 7 deletions src/Transmitron/Tabs/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,13 +953,16 @@ void Client::onSnippetsContext(wxDataViewEvent& e)
menu.Append(publish);
}

auto *overwrite = new wxMenuItem(
nullptr,
(unsigned)ContextIDs::SnippetOverwrite,
"Overwrite"
);
overwrite->SetBitmap(wxArtProvider::GetBitmap(wxART_FILE_SAVE_AS));
menu.Append(overwrite);
if (!mSnippetsModel->IsContainer(item))
{
auto *overwrite = new wxMenuItem(
nullptr,
(unsigned)ContextIDs::SnippetOverwrite,
"Overwrite"
);
overwrite->SetBitmap(wxArtProvider::GetBitmap(wxART_FILE_SAVE_AS));
menu.Append(overwrite);
}

auto *rename = new wxMenuItem(
nullptr,
Expand Down
1 change: 1 addition & 0 deletions src/Transmitron/Tabs/Homepage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ void Homepage::setupProfileForm()
wxDefaultPosition,
wxSize(-1, OptionsHeight)
);
mSave->SetBitmap(wxArtProvider::GetBitmap(wxART_FILE_SAVE));
mSave->Enable(false);

auto *bottomSizer = new wxBoxSizer(wxHORIZONTAL);
Expand Down
31 changes: 22 additions & 9 deletions src/Transmitron/Widgets/Edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <tinyxml2.h>
#include <wx/clipbrd.h>
#include <wx/artprov.h>
#include <wx/sizer.h>
#include <wx/stc/stc.h>
#include "Edit.hpp"
#include "Transmitron/Events/Edit.hpp"
Expand Down Expand Up @@ -58,6 +59,13 @@ Edit::Edit(
wxQueueEvent(this, e);
});

auto *formatLabel = new wxStaticText(
this,
-1,
"Format: ",
wxDefaultPosition
);

constexpr size_t FormatButtonWidth = 100;

mFormatSelect = new wxComboBox(
Expand Down Expand Up @@ -130,6 +138,7 @@ Edit::Edit(
mTop->Add(mPublish, 0, wxEXPAND);
mBottom->Add(mSaveSnippet, 0, wxEXPAND);
mBottom->AddStretchSpacer(1);
mBottom->Add(formatLabel, 0, wxALIGN_CENTER_VERTICAL);
mBottom->Add(mFormatSelect, 0, wxEXPAND);
mVsizer->Add(mTop, 0, wxEXPAND);
mVsizer->Add(mTimestamp, 0, (int)wxEXPAND | (int)wxLEFT, timestampBorderPx);
Expand All @@ -151,16 +160,21 @@ void Edit::setupScintilla()
mText->SetScrollWidthTracking(true);

// Folding margins.
constexpr int MarginScriptFoldIndex = 1;
constexpr int FoldMarginWidth = 20;
mText->SetMarginWidth(MarginScriptFoldIndex, 0);
mText->SetMarginType(MarginScriptFoldIndex, wxSTC_MARGIN_SYMBOL);
mText->SetMarginMask(MarginScriptFoldIndex, (int)wxSTC_MASK_FOLDERS);
mText->SetMarginWidth(MarginScriptFoldIndex, FoldMarginWidth);
mText->SetMarginSensitive(MarginScriptFoldIndex, true);
constexpr int MarginFoldIndex = 1;
constexpr int MarginFoldWidth = 20;
mText->SetMarginType(MarginFoldIndex, wxSTC_MARGIN_SYMBOL);
mText->SetMarginMask(MarginFoldIndex, (int)wxSTC_MASK_FOLDERS);
mText->SetMarginWidth(MarginFoldIndex, MarginFoldWidth);
mText->SetMarginSensitive(MarginFoldIndex, true);
mText->SetAutomaticFold(wxSTC_AUTOMATICFOLD_CLICK);
mText->SetFoldFlags(wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);

// Line number margins.
constexpr int MarginLineNumberIndex = 0;
constexpr int MarginLineNumberWidth = 30;
mText->SetMarginType(MarginLineNumberIndex, wxSTC_MARGIN_NUMBER);
mText->SetMarginWidth(MarginLineNumberIndex, MarginLineNumberWidth);

// Folding markers.
mText->MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_PLUS);
mText->MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_MINUS);
Expand All @@ -170,11 +184,10 @@ void Edit::setupScintilla()
mText->MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY);
mText->MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY);

// Constant styles.
mText->StyleSetForeground(wxSTC_STYLE_DEFAULT, mStyles.at(mTheme).at(Style::Normal).first);
mText->StyleSetBackground(wxSTC_STYLE_DEFAULT, mStyles.at(mTheme).at(Style::Normal).second);
mText->StyleClearAll();
mText->StyleSetForeground(wxSTC_STYLE_LINENUMBER, mStyles.at(mTheme).at(Style::Normal).second);
mText->StyleSetBackground(wxSTC_STYLE_LINENUMBER, mStyles.at(mTheme).at(Style::Normal).first);
}

void Edit::setStyle(Format format)
Expand Down

0 comments on commit b46bf46

Please sign in to comment.