Skip to content

Commit

Permalink
Rename namespaces and config options
Browse files Browse the repository at this point in the history
  • Loading branch information
xeco23 committed Oct 19, 2024
1 parent 686e10e commit 8ca1d1f
Show file tree
Hide file tree
Showing 27 changed files with 91 additions and 91 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ include(GNUInstallDirs)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(WFL_NAME ${CMAKE_PROJECT_NAME})
set(WFL_FRIENDLY_NAME "WasIstLos")
set(WFL_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
set(WFL_HOMEPAGE ${CMAKE_PROJECT_HOMEPAGE_URL})
set(WFL_VERSION ${CMAKE_PROJECT_VERSION})
string(TIMESTAMP WFL_BUILD_DATE "%Y-%m-%d")
set(WFL_APP_ID "com.github.xeco23.WasIstLos")
set(WFL_ICON ${WFL_APP_ID})
set(GETTEXT_PACKAGE ${WFL_NAME})
set(WFL_LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
set(WIL_NAME ${CMAKE_PROJECT_NAME})
set(WIL_FRIENDLY_NAME "WasIstLos")
set(WIL_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
set(WIL_HOMEPAGE ${CMAKE_PROJECT_HOMEPAGE_URL})
set(WIL_VERSION ${CMAKE_PROJECT_VERSION})
string(TIMESTAMP WIL_BUILD_DATE "%Y-%m-%d")
set(WIL_APP_ID "com.github.xeco23.WasIstLos")
set(WIL_ICON ${WIL_APP_ID})
set(GETTEXT_PACKAGE ${WIL_NAME})
set(WIL_LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")

message(STATUS "${CMAKE_PROJECT_NAME} version: ${WFL_VERSION}")
message(STATUS "${CMAKE_PROJECT_NAME} version: ${WIL_VERSION}")

add_subdirectory(src)
add_subdirectory(resource)
Expand Down
8 changes: 4 additions & 4 deletions resource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ execute_process(
)

message(STATUS "Configuring desktop resource files")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/desktop/${WFL_APP_ID}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${WFL_APP_ID}.desktop)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/desktop/${WFL_APP_ID}.appdata.xml.in ${CMAKE_CURRENT_BINARY_DIR}/${WFL_APP_ID}.appdata.xml)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/desktop/${WIL_APP_ID}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${WIL_APP_ID}.desktop)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/desktop/${WIL_APP_ID}.appdata.xml.in ${CMAKE_CURRENT_BINARY_DIR}/${WIL_APP_ID}.appdata.xml)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WFL_APP_ID}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WFL_APP_ID}.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WIL_APP_ID}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WIL_APP_ID}.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/image/icons DESTINATION ${CMAKE_INSTALL_DATADIR})
16 changes: 8 additions & 8 deletions resource/desktop/com.github.xeco23.WasIstLos.appdata.xml.in
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2020-2022 Enes Hecan <[email protected]> -->
<component type="desktop-application">
<id>${WFL_APP_ID}</id>
<id>${WIL_APP_ID}</id>
<metadata_license>FSFAP</metadata_license>
<project_license>GPL-3.0</project_license>
<name>${WFL_FRIENDLY_NAME}</name>
<name>${WIL_FRIENDLY_NAME}</name>
<summary>Unofficial WhatsApp application</summary>
<content_rating type="oars-1.1"/>

<description>
<p>WasIstLos is an unofficial WhatsApp desktop application written in C++.</p>
</description>

<launchable type="desktop-id">${WFL_APP_ID}.desktop</launchable>
<launchable type="desktop-id">${WIL_APP_ID}.desktop</launchable>

<screenshots>
<screenshot type="default">
Expand All @@ -21,18 +21,18 @@
</screenshot>
</screenshots>

<url type="homepage">${WFL_HOMEPAGE}</url>
<url type="bugtracker">${WFL_HOMEPAGE}/issues</url>
<url type="homepage">${WIL_HOMEPAGE}</url>
<url type="bugtracker">${WIL_HOMEPAGE}/issues</url>

<developer_name>Enes Hecan</developer_name>
<update_contact>nshecan_AT_gmail.com</update_contact>

<releases>
<release version="${WFL_VERSION}" date="${WFL_BUILD_DATE}">
<release version="${WIL_VERSION}" date="${WIL_BUILD_DATE}">
<description>
<p>Stable ${WFL_VERSION} release.</p>
<p>Stable ${WIL_VERSION} release.</p>
</description>
<url>https://github.com/xeco23/WasIstLos/releases/tag/v${WFL_VERSION}</url>
<url>https://github.com/xeco23/WasIstLos/releases/tag/v${WIL_VERSION}</url>
</release>
</releases>
</component>
10 changes: 5 additions & 5 deletions resource/desktop/com.github.xeco23.WasIstLos.desktop.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=${WFL_FRIENDLY_NAME}
Name=${WIL_FRIENDLY_NAME}
GenericName=Unofficial WhatsApp client
GenericName[cs]=Neoficiální klient WhatsApp
GenericName[de]=Inoffizieller WhatsApp-Client
Expand All @@ -17,7 +17,7 @@ GenericName[ru]=Неофициальный клиент WhatsApp
GenericName[si]=නිල නොවන WhatsApp සේවාදායකයා
GenericName[tr]=Resmi olmayan WhatsApp istemcisi
GenericName[uk]=Неофіційний клієнт WhatsApp
Comment=${WFL_DESCRIPTION}
Comment=${WIL_DESCRIPTION}
Comment[cs]=Neoficiální desktopová aplikace WhatsApp pro Linux
Comment[de]=Eine inoffizieller WhatsApp Desktop App für Linux
Comment[es]=Una aplicación no oficial de WhatsApp para Linux
Expand All @@ -31,9 +31,9 @@ Comment[ru]=Неофициальное приложение WhatsApp для Linu
Comment[si]=ලිනක්ස් සඳහා නිල නොවන WhatsApp ඩෙස්ක්ටොප් යෙදුමකි
Comment[tr]=Linux için resmi olmayan bir WhatsApp masaüstü uygulaması
Comment[uk]=Неофіційний застосунок WhatsApp для Linux
Exec=${WFL_NAME} %u
Icon=${WFL_ICON}
Exec=${WIL_NAME} %u
Icon=${WIL_ICON}
MimeType=x-scheme-handler/whatsapp
StartupWMClass=${WFL_NAME}
StartupWMClass=${WIL_NAME}
Categories=GTK;GNOME;Network;
Keywords=chat;im;messaging;messenger;sms;whatsapp;whatsapp-desktop;
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parts:
plugin: cmake
override-pull: |
snapcraftctl pull
sed -i.bak -e 's|Icon=${WFL_ICON}|Icon=usr/local/share/icons/hicolor/256x256/apps/com.github.xeco23.WasIstLos.png|g' resource/desktop/com.github.xeco23.WasIstLos.desktop.in
sed -i.bak -e 's|Icon=${WIL_ICON}|Icon=usr/local/share/icons/hicolor/256x256/apps/com.github.xeco23.WasIstLos.png|g' resource/desktop/com.github.xeco23.WasIstLos.desktop.in
cmake-parameters:
- -DCMAKE_BUILD_TYPE=Release
build-packages:
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
message(STATUS "Configuring some source code files")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/VERSION" ${WFL_VERSION})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/VERSION" ${WIL_VERSION})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/Config.hpp)

find_package(PkgConfig REQUIRED)
Expand Down Expand Up @@ -27,7 +27,7 @@ include_directories(${CANBERRA_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

list(APPEND
WFL_SRCS
WIL_SRCS
main.cpp
Resources.c
util/Helper.cpp
Expand All @@ -41,7 +41,7 @@ list(APPEND
ui/WebView.cpp
)

add_executable(${CMAKE_PROJECT_NAME} ${WFL_SRCS})
add_executable(${CMAKE_PROJECT_NAME} ${WIL_SRCS})
target_link_libraries(${CMAKE_PROJECT_NAME}
${GTKMM_LIBRARIES}
${WEBKIT_LIBRARIES}
Expand Down
18 changes: 9 additions & 9 deletions src/Config.hpp.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#define WFL_NAME "${WFL_NAME}"
#define WFL_FRIENDLY_NAME "${WFL_FRIENDLY_NAME}"
#define WFL_DESCRIPTION "${WFL_DESCRIPTION}"
#define WFL_HOMEPAGE "${WFL_HOMEPAGE}"
#define WFL_VERSION "${WFL_VERSION}"
#define WFL_BUILD_DATE "${WFL_BUILD_DATE}"
#define WFL_APP_ID "${WFL_APP_ID}"
#define WFL_ICON "${WFL_ICON}"
#define WFL_LOCALEDIR "${WFL_LOCALEDIR}"
#define WIL_NAME "${WIL_NAME}"
#define WIL_FRIENDLY_NAME "${WIL_FRIENDLY_NAME}"
#define WIL_DESCRIPTION "${WIL_DESCRIPTION}"
#define WIL_HOMEPAGE "${WIL_HOMEPAGE}"
#define WIL_VERSION "${WIL_VERSION}"
#define WIL_BUILD_DATE "${WIL_BUILD_DATE}"
#define WIL_APP_ID "${WIL_APP_ID}"
#define WIL_ICON "${WIL_ICON}"
#define WIL_LOCALEDIR "${WIL_LOCALEDIR}"
#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}"
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ namespace
{
void sigterm(int)
{
wfl::ui::Application::getInstance().quit();
wil::ui::Application::getInstance().quit();
}
}

int main(int argc, char** argv)
{
setlocale(LC_ALL, "");

bindtextdomain(GETTEXT_PACKAGE, WFL_LOCALEDIR);
bindtextdomain(GETTEXT_PACKAGE, WIL_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);

auto app = wfl::ui::Application{argc, argv};
auto app = wil::ui::Application{argc, argv};

wfl::util::redirectOutputToLogger();
wil::util::redirectOutputToLogger();

signal(SIGINT, sigterm);
signal(SIGTERM, sigterm);
Expand Down
12 changes: 6 additions & 6 deletions src/ui/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Config.hpp"
#include "../util/Settings.hpp"

namespace wfl::ui
namespace wil::ui
{
Application* Application::m_instance = nullptr;

Expand All @@ -14,7 +14,7 @@ namespace wfl::ui
}

Application::Application(int argc, char** argv)
: Gtk::Application{argc, argv, WFL_APP_ID, Gio::APPLICATION_HANDLES_OPEN}
: Gtk::Application{argc, argv, WIL_APP_ID, Gio::APPLICATION_HANDLES_OPEN}
, m_onHold{false}
, m_mainWindow{nullptr}
{
Expand Down Expand Up @@ -52,7 +52,7 @@ namespace wfl::ui

auto const refBuilder = Gtk::Builder::create_from_resource("/main/ui/MainWindow.ui");

wfl::ui::MainWindow* window = nullptr;
wil::ui::MainWindow* window = nullptr;
refBuilder->get_widget_derived("window_main", window);
m_mainWindow.reset(window);

Expand All @@ -63,8 +63,8 @@ namespace wfl::ui
{
Gtk::Application::on_activate();

if (wfl::util::Settings::getInstance().getValue<bool>("general", "start-in-tray")
&& wfl::util::Settings::getInstance().getValue<bool>("general", "close-to-tray"))
if (wil::util::Settings::getInstance().getValue<bool>("general", "start-in-tray")
&& wil::util::Settings::getInstance().getValue<bool>("general", "close-to-tray"))
{
if (!m_onHold)
{
Expand All @@ -76,7 +76,7 @@ namespace wfl::ui
m_mainWindow->present();
}
}
else if (wfl::util::Settings::getInstance().getValue<bool>("general", "start-minimized"))
else if (wil::util::Settings::getInstance().getValue<bool>("general", "start-minimized"))
{
m_mainWindow->is_visible() ? m_mainWindow->iconify() : m_mainWindow->deiconify();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gtkmm/application.h>
#include "MainWindow.hpp"

namespace wfl::ui
namespace wil::ui
{
class Application : public Gtk::Application
{
Expand Down
14 changes: 7 additions & 7 deletions src/ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Config.hpp"
#include "../util/Settings.hpp"

namespace wfl::ui
namespace wil::ui
{
MainWindow::MainWindow(BaseObjectType* cobject, Glib::RefPtr<Gtk::Builder> const& refBuilder)
: Gtk::ApplicationWindow{cobject}
Expand All @@ -24,10 +24,10 @@ namespace wfl::ui
, m_buttonZoomLevel{nullptr}
, m_fullscreen{false}
{
auto const appIcon16x16 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/16x16/apps/" WFL_ICON ".png");
auto const appIcon32x32 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/32x32/apps/" WFL_ICON ".png");
auto const appIcon64x64 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/64x64/apps/" WFL_ICON ".png");
auto const appIcon128x128 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/128x128/apps/" WFL_ICON ".png");
auto const appIcon16x16 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/16x16/apps/" WIL_ICON ".png");
auto const appIcon32x32 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/32x32/apps/" WIL_ICON ".png");
auto const appIcon64x64 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/64x64/apps/" WIL_ICON ".png");
auto const appIcon128x128 = Gdk::Pixbuf::create_from_resource("/main/image/icons/hicolor/128x128/apps/" WIL_ICON ".png");
set_icon_list({appIcon16x16, appIcon32x32, appIcon64x64, appIcon128x128});
set_default_icon(appIcon64x64);

Expand Down Expand Up @@ -341,10 +341,10 @@ namespace wfl::ui
auto aboutDialog = Gtk::AboutDialog{};

aboutDialog.set_title(_("About"));
aboutDialog.set_version(WFL_VERSION);
aboutDialog.set_version(WIL_VERSION);
aboutDialog.set_program_name(_("WasIstLos"));
aboutDialog.set_comments(_("An unofficial WhatsApp desktop application for Linux"));
aboutDialog.set_website(WFL_HOMEPAGE);
aboutDialog.set_website(WIL_HOMEPAGE);
aboutDialog.set_website_label(_("GitHub Repository"));
aboutDialog.set_license_type(Gtk::LICENSE_GPL_3_0);

Expand Down
2 changes: 1 addition & 1 deletion src/ui/MainWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "WebView.hpp"
#include "../util/Sound.hpp"

namespace wfl::ui
namespace wil::ui
{
class MainWindow : public Gtk::ApplicationWindow
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/PhoneNumberDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "PhoneNumberDialog.hpp"

namespace wfl::ui
namespace wil::ui
{
PhoneNumberDialog::PhoneNumberDialog(BaseObjectType* cobject, Glib::RefPtr<Gtk::Builder> const& refBuilder)
: Gtk::Dialog{cobject}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/PhoneNumberDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <gtkmm/button.h>
#include <gtkmm/entry.h>

namespace wfl::ui
namespace wil::ui
{
class PhoneNumberDialog : public Gtk::Dialog
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/PreferencesWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gtkmm/settings.h>
#include "../util/Settings.hpp"

namespace wfl::ui
namespace wil::ui
{
PreferencesWindow::PreferencesWindow(BaseObjectType* cobject, Glib::RefPtr<Gtk::Builder> const& refBuilder, TrayIcon& trayIcon, WebView& webView)
: Gtk::Window{cobject}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/PreferencesWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "TrayIcon.hpp"
#include "WebView.hpp"

namespace wfl::ui
namespace wil::ui
{
class PreferencesWindow : public Gtk::Window
{
Expand Down
12 changes: 6 additions & 6 deletions src/ui/TrayIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
#include <gtkmm/icontheme.h>
#include "Config.hpp"

namespace wfl::ui
namespace wil::ui
{
namespace
{
std::pair<char const*, char const*> getTrayIconNames()
{
constexpr auto WHATSAPP_TRAY = "whatsapp-tray";
constexpr auto WHATSAPP_TRAY_ATTENTION = "whatsapp-tray-attention";
constexpr auto WASISTLOS_TRAY = WFL_ICON "-tray";
constexpr auto WASISTLOS_TRAY_ATTENTION = WFL_ICON "-tray-attention";
constexpr auto WASISTLOS_TRAY = WIL_ICON "-tray";
constexpr auto WASISTLOS_TRAY_ATTENTION = WIL_ICON "-tray-attention";

auto const iconTheme = Gtk::IconTheme::get_default();
if (iconTheme->has_icon(WHATSAPP_TRAY) && iconTheme->has_icon(WHATSAPP_TRAY_ATTENTION))
Expand All @@ -32,15 +32,15 @@ namespace wfl::ui
}

TrayIcon::TrayIcon()
: m_appIndicator{app_indicator_new(WFL_APP_ID ".Tray", "", APP_INDICATOR_CATEGORY_COMMUNICATIONS)}
: m_appIndicator{app_indicator_new(WIL_APP_ID ".Tray", "", APP_INDICATOR_CATEGORY_COMMUNICATIONS)}
, m_popupMenu{}
, m_signalShow{}
, m_signalAbout{}
, m_signalQuit{}
{
auto const [trayIconName, attentionIconName] = getTrayIconNames();
app_indicator_set_icon_full(m_appIndicator, trayIconName, WFL_FRIENDLY_NAME " Tray");
app_indicator_set_attention_icon_full(m_appIndicator, attentionIconName, WFL_FRIENDLY_NAME "Tray Attention");
app_indicator_set_icon_full(m_appIndicator, trayIconName, WIL_FRIENDLY_NAME " Tray");
app_indicator_set_attention_icon_full(m_appIndicator, attentionIconName, WIL_FRIENDLY_NAME "Tray Attention");

auto const showMenuItem = Gtk::manage(new Gtk::MenuItem{_("Show")});
auto const aboutMenuItem = Gtk::manage(new Gtk::MenuItem{_("About")});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/TrayIcon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <libayatana-appindicator/app-indicator.h>
#include <gtkmm/menu.h>

namespace wfl::ui
namespace wil::ui
{
class TrayIcon
{
Expand Down
Loading

0 comments on commit 8ca1d1f

Please sign in to comment.