From bf4a8c314f308877841dcfa8c567cdd097c0fbb0 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Date: Tue, 26 Jul 2022 09:22:44 -0400
Subject: [PATCH] misc: Rename jami-qt to jami and remove launcher script.

Now that there is no longer a second official client (jami-gnome), we
can remove this uninteresting implementation detail from the name.

Mostly automated via:

  $ git grep jami-qt -l | xargs sed 's/jami-qt/jami/g' -i

* src/app/jami: Delete launcher script.
* CMakeLists.txt: Un-register it from installation.

Change-Id: I5167c29089feb4e64c12d7d01c1ce281e16c0613
---
 CMakeLists.txt                                | 20 +++---------
 INSTALL.md                                    | 10 +++---
 README.md                                     |  4 +--
 doc/{jami-qt.1 => jami.1}                     | 10 +++---
 .../{jami-qt.appdata.xml => jami.appdata.xml} |  4 +--
 extras/data/{jami-qt.desktop => jami.desktop} |  2 +-
 extras/scripts/update-translations.py         |  6 ++--
 src/app/constant/JamiStrings.qml              |  2 +-
 src/app/jami                                  | 31 -------------------
 src/app/main.cpp                              |  2 +-
 src/app/screensaver.cpp                       |  2 +-
 src/app/utils.cpp                             | 14 ++++-----
 12 files changed, 33 insertions(+), 74 deletions(-)
 rename doc/{jami-qt.1 => jami.1} (62%)
 rename extras/data/{jami-qt.appdata.xml => jami.appdata.xml} (97%)
 rename extras/data/{jami-qt.desktop => jami.desktop} (96%)
 delete mode 100644 src/app/jami

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4241022b6..f2850f5d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ cmake_minimum_required(VERSION 3.16)
 if(APPLE)
   project(Jami)
 else()
-  project(jami-qt)
+  project(jami)
 endif()
 
 set(CMAKE_CXX_STANDARD 17)
@@ -585,13 +585,13 @@ elseif (NOT APPLE)
   # Install .desktop in XDG desktop direcory so that it is recognized
   # by the system.
   install(
-    FILES ${DATA_DIR}/jami-qt.desktop
+    FILES ${DATA_DIR}/jami.desktop
     DESTINATION ${JAMI_DATA_PREFIX}/applications)
 
-  # Install .desktop in the jami-qt data directory, so that it can be
+  # Install .desktop in the jami data directory, so that it can be
   # copied to the autostart directory by the client.
   install(
-    FILES ${DATA_DIR}/jami-qt.desktop
+    FILES ${DATA_DIR}/jami.desktop
     DESTINATION "${JAMI_DATA_PREFIX}/${PROJECT_NAME}"
     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) # 644
 
@@ -627,19 +627,9 @@ elseif (NOT APPLE)
     RENAME jami.xpm)
 
   install(
-    FILES ${DATA_DIR}/jami-qt.appdata.xml
+    FILES ${DATA_DIR}/jami.appdata.xml
     DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
 
-  # Install 'jami' launcher that automatically chooses between clients
-  install(
-    FILES
-    "${APP_SRC_DIR}/jami"
-    DESTINATION
-    ${CMAKE_INSTALL_PREFIX}/bin
-    PERMISSIONS
-    OWNER_READ OWNER_WRITE OWNER_EXECUTE
-    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) # 755
-
   # Add a target to generate API documentation using Doxygen and
   # graphviz-dot.
   find_package(Doxygen)
diff --git a/INSTALL.md b/INSTALL.md
index c30688392..f21ff7e5c 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -79,7 +79,7 @@ Then, you can build daemon and the client with:
 ./build.py --install --qt
 ```
 
-And you will have the daemon in `daemon/bin/jamid` and the client in `client-qt/build-local/jami-qt`. You also can run it with
+And you will have the daemon in `daemon/bin/jamid` and the client in `client-qt/build-local/jami`. You also can run it with
 
 If you use a Qt version that is not wide-system installed you need to specify its path after the `--qt` flag, i. e., `./build.py --install --qt /home/<username>/Qt/6.2.1/gcc_64
 
@@ -124,7 +124,7 @@ e.g. (with Qt version from https://jami.net)
 cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=jami-project/install/client-qt -DCMAKE_PREFIX_PATH=/usr/lib/libqt-jami
 ```
 
-After the build has finished, you are finally ready to launch jami-qt in your build directory.
+After the build has finished, you are finally ready to launch jami in your build directory.
 
 If you want to install it to the path provided by `CMAKE_INSTALL_PREFIX` you can run:
 
@@ -201,7 +201,7 @@ When that happens you need to compile the client separately:
 
 ### Build Module Individually
 
-- Jami-qt also support building each module (daemon, jami-qt) seperately
+- Jami also supports building each module (daemon, jami) separately
 
 **Daemon**
 
@@ -222,7 +222,7 @@ When that happens you need to compile the client separately:
     python winmake.py -b opendht
 ```
 
-**Jami-qt**
+**Jami**
 
 - Make sure that daemon, is built first
 
@@ -300,4 +300,4 @@ Built client could be find in `client-qt/build-local/Jami`
 Compile the client with `BUILD=Debug` and compile LibRingClient with
 `-DCMAKE_BUILD_TYPE=Debug`
 
-Then, if you want to enable logging when running `jami-qt` launch it with `-d` or `--debug`
+Then, if you want to enable logging when running `jami` launch it with `-d` or `--debug`
diff --git a/README.md b/README.md
index 5505d7918..1a613414a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Jami-qt
+# Jami
 
 ![jami-logo](https://jami.net/assets/images/logo-jami.svg?v=8595727d35)
 
@@ -8,7 +8,7 @@
 
 Jami provides all its users a universal communication tool, autonomous, free, secure and built on a distributed architecture thus requiring no authority or central server to function.
 
-`jami-qt` is the cross platform client for [Jami](https://jami.net/).
+`jami` is the cross platform client for [Jami](https://jami.net/).
 
 For more information about the jami project, see the following:
 
diff --git a/doc/jami-qt.1 b/doc/jami.1
similarity index 62%
rename from doc/jami-qt.1
rename to doc/jami.1
index 9e4f4c0df..9abc31399 100644
--- a/doc/jami-qt.1
+++ b/doc/jami.1
@@ -1,11 +1,11 @@
-.\" Manpage for jami-qt.
-.TH man 8 "08 April 2021" "1.0" "jami-qt man page"
+.\" Manpage for jami.
+.TH man 8 "08 April 2021" "1.0" "jami man page"
 .SH NAME
-jami-qt \- Qt client for jami.net
+jami \- Client for jami.net
 .SH SYNOPSIS
-jami-qt [options]
+jami [options]
 .SH DESCRIPTION
-jami-qt is a qt client for jami.net
+jami is a qt client for jami.net
 .SH OPTIONS
 .B \-v, \-\-version
 Display the version and exit.
diff --git a/extras/data/jami-qt.appdata.xml b/extras/data/jami.appdata.xml
similarity index 97%
rename from extras/data/jami-qt.appdata.xml
rename to extras/data/jami.appdata.xml
index f2a750c3e..a9316504b 100644
--- a/extras/data/jami-qt.appdata.xml
+++ b/extras/data/jami.appdata.xml
@@ -103,9 +103,9 @@
   </screenshot>
  </screenshots>
 
- <launchable type="desktop-id">jami-qt.desktop</launchable>
+ <launchable type="desktop-id">jami.desktop</launchable>
 
- <provides><binary>jami-qt</binary><binary>jami</binary></provides>
+ <provides><binary>jami</binary></provides>
 
  <!-- https://specifications.freedesktop.org/menu-spec/latest/apa.html -->
  <!-- https://specifications.freedesktop.org/menu-spec/latest/apas02.html -->
diff --git a/extras/data/jami-qt.desktop b/extras/data/jami.desktop
similarity index 96%
rename from extras/data/jami-qt.desktop
rename to extras/data/jami.desktop
index 7fe6a43f2..f632c567e 100644
--- a/extras/data/jami-qt.desktop
+++ b/extras/data/jami.desktop
@@ -4,7 +4,7 @@ GenericName=Jami
 Comment=Privacy-oriented voice, video, chat, and conference platform
 Comment[hu]=Adatvédelem-orientált hang-, video-, csevegés- és konferenciaplatform
 Comment[ru]=Jami — приложение для защищённой связи с распределённой архитектурой
-Exec=jami-qt %u
+Exec=jami %u
 Icon=jami
 StartupNotify=true
 Terminal=false
diff --git a/extras/scripts/update-translations.py b/extras/scripts/update-translations.py
index 4f2be86b8..dcfc392fe 100755
--- a/extras/scripts/update-translations.py
+++ b/extras/scripts/update-translations.py
@@ -25,9 +25,9 @@ import os
 import shutil
 
 print("== Updating from sources")
-if os.system("lupdate jami-qt.pro -no-obsolete"):
+if os.system("lupdate jami.pro -no-obsolete"):
     print("trying with 'lupdate-qt5'")
-    if os.system("lupdate-qt5 jami-qt.pro -no-obsolete"):
+    if os.system("lupdate-qt5 jami.pro -no-obsolete"):
         raise RuntimeError("unable to find any suitable lupdate Qt tool on this system. Stopping")
 
 print("== Pushing sources")
@@ -43,7 +43,7 @@ translationFiles = []
 for filename in os.listdir('./translations'):
     translationFiles.append("translations/{0}".format(filename))
 
-proFile = "jami-qt.pro"
+proFile = "jami.pro"
 shutil.move(proFile, proFile + "~")
 
 destination = open(proFile, "w")
diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml
index 3c6f5f577..67f5781ae 100644
--- a/src/app/constant/JamiStrings.qml
+++ b/src/app/constant/JamiStrings.qml
@@ -25,7 +25,7 @@ import net.jami.Helpers 1.1
 
 Item {
     readonly property string appTitle: "Jami"
-    readonly property string httpUserAgentName: "jami-qt"
+    readonly property string httpUserAgentName: "jami"
 
     // Misc
     property string accept: qsTr("Accept")
diff --git a/src/app/jami b/src/app/jami
deleted file mode 100644
index 9d976636b..000000000
--- a/src/app/jami
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-#
-#  Copyright (C) 2015-2022 Savoir-faire Linux Inc.
-#  Author: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
-#  Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
-#  Author: Albert Babí <albert.babi@savoirfairelinux.com>
-#  Author: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-#
-#  This program 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.
-#
-#  This program 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 this program; if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
-#
-
-if command -v jami-qt > /dev/null; then
-    exec jami-qt "$@"
-elif command -v jami-gnome > /dev/null; then
-    exec jami-gnome "$@"
-else
-    echo "Jami not found" > /dev/error
-    exit 1
-fi
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 90f3e7832..93f03ac22 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -109,7 +109,7 @@ main(int argc, char* argv[])
     auto newArgv = parseInputArgument(argc, argv, qtWebEngineChromiumFlags);
 
     MainApplication app(argc, newArgv);
-    app.setDesktopFileName(QStringLiteral("jami-qt"));
+    app.setDesktopFileName(QStringLiteral("jami"));
 #if defined(Q_OS_MACOS)
     if (macutils::isMetalSupported()) {
         QQuickWindow::setGraphicsApi(QSGRendererInterface::MetalRhi);
diff --git a/src/app/screensaver.cpp b/src/app/screensaver.cpp
index 443348bb5..b03639aeb 100644
--- a/src/app/screensaver.cpp
+++ b/src/app/screensaver.cpp
@@ -73,7 +73,7 @@ ScreenSaver::inhibit(void)
         }
     }
 
-    QDBusReply<uint> reply = screenSaverInterface_->call("Inhibit", "jami-qt", "In a call");
+    QDBusReply<uint> reply = screenSaverInterface_->call("Inhibit", "jami", "In a call");
     if (reply.isValid()) {
         qDebug() << "Screen saver inhibited";
         request_ = static_cast<uint>(reply.value());
diff --git a/src/app/utils.cpp b/src/app/utils.cpp
index 4b7610e42..ea6e85e29 100644
--- a/src/app/utils.cpp
+++ b/src/app/utils.cpp
@@ -123,9 +123,9 @@ Utils::CreateStartupLink(const std::wstring& wstrAppName)
 
 #ifdef JAMI_INSTALL_PREFIX
     desktopPath = JAMI_INSTALL_PREFIX;
-    desktopPath += "/jami-qt/jami-qt.desktop";
+    desktopPath += "/jami/jami.desktop";
 #else
-    desktopPath = "share/jami-qt/jami-qt.desktop";
+    desktopPath = "share/jami/jami.desktop";
     QStringList paths = {"/usr/" + desktopPath,
                          "/usr/local/" + desktopPath,
                          QDir::currentPath() + "/../../install/client-qt/" + desktopPath};
@@ -145,7 +145,7 @@ Utils::CreateStartupLink(const std::wstring& wstrAppName)
     qDebug() << "Linking autostart file from" << desktopPath;
 
     QString desktopFile = QStandardPaths::locate(QStandardPaths::ConfigLocation,
-                                                 "autostart/jami-qt.desktop");
+                                                 "autostart/jami.desktop");
     if (!desktopFile.isEmpty()) {
         QFileInfo symlinkInfo(desktopFile);
         if (symlinkInfo.isSymLink()) {
@@ -169,7 +169,7 @@ Utils::CreateStartupLink(const std::wstring& wstrAppName)
                 return false;
             }
         }
-        desktopFile = autoStartDir + "/jami-qt.desktop";
+        desktopFile = autoStartDir + "/jami.desktop";
     }
 
     QFile srcFile(desktopPath);
@@ -227,7 +227,7 @@ Utils::DeleteStartupLink(const std::wstring& wstrAppName)
 #else
     Q_UNUSED(wstrAppName)
     QString desktopFile = QStandardPaths::locate(QStandardPaths::ConfigLocation,
-                                                 "autostart/jami-qt.desktop");
+                                                 "autostart/jami.desktop");
     if (!desktopFile.isEmpty()) {
         try {
             QFile::remove(desktopFile);
@@ -253,8 +253,8 @@ Utils::CheckStartupLink(const std::wstring& wstrAppName)
     return PathFileExists(linkPath.c_str());
 #else
     Q_UNUSED(wstrAppName)
-    return (!QStandardPaths::locate(QStandardPaths::ConfigLocation, "autostart/jami-qt.desktop")
-                 .isEmpty());
+    return (
+        !QStandardPaths::locate(QStandardPaths::ConfigLocation, "autostart/jami.desktop").isEmpty());
 #endif
 }
 
-- 
GitLab