Skip to content

Commit

Permalink
Support for CMake and OpenSSH for Windows added, Qt upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Syping committed Oct 7, 2020
1 parent cd4b985 commit 0cf2056
Show file tree
Hide file tree
Showing 21 changed files with 336 additions and 179 deletions.
19 changes: 1 addition & 18 deletions AppEnv.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
* tunnelmanager - Simple GUI for SSH Tunnels
*
* Copyright (C) 2017 Syping
* Copyright (C) 2017-2020 Syping
* Copyright (C) 2017 Soner Sayakci
*
* This software may be modified and distributed under the terms
Expand All @@ -21,7 +21,6 @@

AppEnv::AppEnv()
{

}

// Folder Stuff
Expand Down Expand Up @@ -53,22 +52,6 @@ QString AppEnv::getPluginsFolder()
return convertBuildedString(TM_PLUG);
}

// Screen Stuff

qreal AppEnv::screenRatio()
{
#if QT_VERSION >= 0x050000
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
#else
qreal dpi = qApp->desktop()->logicalDpiX();
#endif
#ifdef Q_OS_MAC
return (dpi / 72);
#else
return (dpi / 96);
#endif
}

// Convert Stuff

QString AppEnv::convertBuildedString(const QString &buildedStr)
Expand Down
5 changes: 1 addition & 4 deletions AppEnv.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
* tunnelmanager - Simple GUI for SSH Tunnels
*
* Copyright (C) 2017 Syping
* Copyright (C) 2017-2020 Syping
* Copyright (C) 2017 Soner Sayakci
*
* This software may be modified and distributed under the terms
Expand All @@ -24,9 +24,6 @@ class AppEnv
static QString getExLangFolder();
static QString getInLangFolder();
static QString getPluginsFolder();

// Screen Stuff
static qreal screenRatio();

// Convert Stuff
static QString convertBuildedString(const QString &buildedStr);
Expand Down
153 changes: 153 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
cmake_minimum_required(VERSION 3.5)

project(tunnelmanager LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS LinguistTools QUIET)

if(WIN32)
list(APPEND TUNNELMANAGER_DEFINES
-DUNICODE
-D_UNICODE
-DWIN32
)
list(APPEND TUNNELMANAGER_RESOURCES
app.rc
)
endif()

set(TUNNELMANAGER_SOURCES
main.cpp
mainwindow.cpp
newentry.cpp
AppEnv.cpp
TranslationClass.cpp
)

set(TUNNELMANAGER_HEADERS
config.h
mainwindow.h
newentry.h
AppEnv.h
TranslationClass.h
)

set(TUNNELMANAGER_FORMS
mainwindow.ui
newentry.ui
)

list(APPEND TUNNELMANAGER_RESOURCES
res.qrc
)

if(Qt5LinguistTools_FOUND)
qt5_add_translation(TUNNELMANAGER_TRANSLATIONS
lang/tm_de.ts
)
add_custom_target(translations DEPENDS ${TUNNELMANAGER_TRANSLATIONS})
else()
set(TUNNELMANAGER_TRANSLATIONS
lang/tm_de.qm
)
endif()

option(QCONF_BUILD "System installation intended Qconf build" OFF)
if(QCONF_BUILD)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_QCONF
)
else()
list(APPEND TUNNELMANAGER_RESOURCES
lang/tm_tr.qrc
lang/tr_qt5.qrc
)
endif()

if(TUNNELMANAGER_APPVER)
list(APPEND TUNNELMANAGER_DEFINES
"-DTM_APPVER=\"${TUNNELMANAGER_APPVER}\""
)
endif()
if(TUNNELMANAGER_BUILDTYPE)
list(APPEND TUNNELMANAGER_DEFINES
"-DTM_BUILDTYPE=\"${TUNNELMANAGER_BUILDTYPE}\""
)
else()
if(TUNNELMANAGER_BUILDTYPE_ALPHA)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_BUILDTYPE_ALPHA
)
endif()
if(TUNNELMANAGER_BUILDTYPE_BETA)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_BUILDTYPE_BETA
)
endif()
if(TUNNELMANAGER_BUILDTYPE_DEV)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_BUILDTYPE_DEV
)
endif()
if(TUNNELMANAGER_BUILDTYPE_DAILY)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_BUILDTYPE_DAILY
)
endif()
if(TUNNELMANAGER_BUILDTYPE_RC)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_BUILDTYPE_RC
)
endif()
if(TUNNELMANAGER_BUILDTYPE_REL)
list(APPEND TUNNELMANAGER_DEFINES
-DTM_BUILDTYPE_REL
)
endif()
endif()

if(TUNNELMANAGER_INLANG)
list(APPEND TUNNELMANAGER_DEFINES
"-DTM_INLANG=\"${TUNNELMANAGER_INLANG}\""
)
endif()
if(TUNNELMANAGER_LANG)
list(APPEND TUNNELMANAGER_DEFINES
"-DTM_LANG=\"${TUNNELMANAGER_LANG}\""
)
endif()

add_executable(tunnelmanager
WIN32 MACOSX_BUNDLE
${TUNNELMANAGER_HEADERS}
${TUNNELMANAGER_SOURCES}
${TUNNELMANAGER_FORMS}
${TUNNELMANAGER_RESOURCES}
)

if(Qt5LinguistTools_FOUND AND QCONF_BUILD)
add_dependencies(tunnelmanager translations)
endif()

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0")
target_precompile_headers(tunnelmanager PRIVATE config.h)
endif()

target_compile_definitions(tunnelmanager PRIVATE ${TUNNELMANAGER_DEFINES})
target_link_libraries(tunnelmanager PRIVATE Qt5::Widgets ${TUNNELMANAGER_LIBS})

install(TARGETS tunnelmanager DESTINATION bin)
install(FILES de.shyim.tunnelmanager.desktop DESTINATION share/applications)
install(FILES server.png DESTINATION share/pixmaps RENAME de.shyim.tunnelmanager.png)
if(QCONF_BUILD)
install(FILES ${TUNNELMANAGER_TRANSLATIONS} DESTINATION share/tunnelmanager/translations)
endif()
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Simple GUI for SSH Tunnels

# Requirements
* Windows, Mac or Linux
* plink on Windows, openssh on Linux/Mac
* Windows, macOS, Linux or BSD
* Plink/OpenSSH on Windows, OpenSSH on macOS/Linux/BSD
* Authentification with ssh-key

# Building
Expand All @@ -17,6 +17,13 @@ Use [`qmake`](http://doc.qt.io/qt-5/qmake-manual.html) to generate a `Makefile`

$ qmake
$ make

## cmake

Use [`cmake`](https://cmake.org/) to generate a `Makefile` and use `make` to compile the project

$ cmake
$ make

# Screenshots
![Imgur](https://i.imgur.com/ZDHmDE0.png)
12 changes: 5 additions & 7 deletions TunnelManager.pro
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#/*****************************************************************************
#* tunnelmanager - Simple GUI for SSH Tunnels
#*
#* Copyright (C) 2017-2020 Syping
#* Copyright (C) 2017 Soner Sayakci
#* Copyright (C) 2017 Syping
#*
#* This software may be modified and distributed under the terms
#* of the MIT license. See the LICENSE file for details.
#*
#*****************************************************************************/

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += core gui widgets

TARGET = tunnelmanager
TEMPLATE = app
Expand Down Expand Up @@ -40,11 +38,11 @@ FORMS += \

RESOURCES += \
res.qrc \
lang\tm_tr.qrc \
lang\tr_qt5.qrc
lang/tm_tr.qrc \
lang/tr_qt5.qrc

TRANSLATIONS += \
lang\tm_de.ts
lang/tm_de.ts

OTHER_FILES += \
app.rc \
Expand Down
12 changes: 6 additions & 6 deletions app.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IDI_ICON1 ICON DISCARDABLE "server.ico"
IDI_ICON1 ICON DISCARDABLE "server.ico"

#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
Expand All @@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "TunnelManager.exe.manifest"
#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 0, 0, 0
PRODUCTVERSION 1, 0, 0, 0
FILEVERSION 0, 2, 0, 0
PRODUCTVERSION 0, 2, 0, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
Expand All @@ -25,12 +25,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Shyim\0"
VALUE "FileDescription", "TunnelManager\0"
VALUE "FileVersion", "1.0.0.0\0"
VALUE "FileVersion", "0.2.0\0"
VALUE "InternalName", "TunnelManager\0"
VALUE "LegalCopyright", "Copyright � 2017 Shyim\0"
VALUE "LegalCopyright", "Copyright � 2017-2020 Shyim\0"
VALUE "OriginalFilename", "TunnelManager.exe\0"
VALUE "ProductName", "TunnelManager\0"
VALUE "ProductVersion", "1.0.0.0\0"
VALUE "ProductVersion", "0.2.0\0"
END
END
END
13 changes: 3 additions & 10 deletions config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
* tunnelmanager - Simple GUI for SSH Tunnels
*
* Copyright (C) 2017 Syping
* Copyright (C) 2017-2020 Syping
* Copyright (C) 2017 Soner Sayakci
*
* This software may be modified and distributed under the terms
Expand Down Expand Up @@ -29,11 +29,11 @@
#endif

#ifndef TM_COPYRIGHT
#define TM_COPYRIGHT "2017"
#define TM_COPYRIGHT "2017-2020"
#endif

#ifndef TM_APPVER
#define TM_APPVER "1.0.0"
#define TM_APPVER "0.2.0"
#endif

#ifdef TM_BUILDTYPE_REL
Expand Down Expand Up @@ -83,9 +83,6 @@
#ifndef TM_LANG
#define TM_LANG "QCONFLANG:"
#endif
#ifndef TM_PLUG
#define TM_PLUG "QCONFPLUG:"
#endif
#ifdef TM_QCONF_IN
#ifndef TM_INLANG
#define TM_INLANG ":/tr"
Expand All @@ -105,10 +102,6 @@
#define TM_PLUG "RUNDIR:SEPARATOR:plugins"
#endif

#ifdef TM_WINRT
#undef TM_WIN
#endif

#ifndef TM_COMPILER
#ifdef __clang__
#ifndef Q_OS_MAC
Expand Down
9 changes: 9 additions & 0 deletions de.shyim.tunnelmanager.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=TunnelManager
Comment=Simple GUI for SSH Tunnels
Categories=Qt;Utility;
Exec=tunnelmanager
Icon=de.shyim.tunnelmanager
Terminal=false
StartupNotify=false
Binary file modified lang/qtbase_de.qm
Binary file not shown.
Binary file modified lang/tm_de.qm
Binary file not shown.
Loading

0 comments on commit 0cf2056

Please sign in to comment.