From 2f2a1e5351f4729c2d70e0e9f402806ad2ca7acc Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 15:56:01 +0300 Subject: [PATCH] add donate link to Help menu - #186 --- src/dlangide/ui/commands.d | 2 ++ src/dlangide/ui/frame.d | 7 ++++--- src/dlangide/ui/homescreen.d | 7 ++++++- views/res/i18n/en.ini | 6 ++++-- views/res/i18n/ru.ini | 2 ++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index b0c3344..dd11b17 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -46,6 +46,7 @@ enum IDEActions : int { HelpAbout, HelpViewHelp, + HelpDonate, WindowCloseDocument, WindowCloseAllDocuments, WindowShowHomeScreen, @@ -130,6 +131,7 @@ const Action ACTION_EDIT_TOGGLE_BLOCK_COMMENT = (new Action(EditorActions.Toggle const Action ACTION_EDIT_PREFERENCES = (new Action(IDEActions.EditPreferences, "MENU_EDIT_PREFERENCES"c, null)).disableByDefault(); const Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABOUT"c); const Action ACTION_HELP_VIEW_HELP = new Action(IDEActions.HelpViewHelp, "MENU_HELP_VIEW_HELP"c); +const Action ACTION_HELP_DONATE = new Action(IDEActions.HelpDonate, "MENU_HELP_DONATE"c); const Action ACTION_WINDOW_CLOSE_DOCUMENT = new Action(IDEActions.WindowCloseDocument, "MENU_WINDOW_CLOSE_DOCUMENT"c, null, KeyCode.KEY_W, KeyFlag.Control); const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowCloseAllDocuments, "MENU_WINDOW_CLOSE_ALL_DOCUMENTS"c); const Action ACTION_WINDOW_SHOW_HOME_SCREEN = new Action(IDEActions.WindowShowHomeScreen, "MENU_WINDOW_SHOW_HOME_SCREEN"c); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index afb6be1..5f1a8d1 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -44,7 +44,6 @@ import std.array : empty; import std.string : split; import std.path; -immutable string HELP_PAGE_URL = "https://github.com/buggins/dlangide/wiki"; // TODO: get version from GIT commit //version is now stored in file views/VERSION immutable dstring DLANGIDE_VERSION = toUTF32(import("VERSION")); @@ -733,8 +732,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL //windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES")); windowItem.add(ACTION_WINDOW_CLOSE_DOCUMENT, ACTION_WINDOW_CLOSE_ALL_DOCUMENTS, ACTION_WINDOW_SHOW_HOME_SCREEN); MenuItem helpItem = new MenuItem(new Action(4, "MENU_HELP"c)); - helpItem.add(ACTION_HELP_VIEW_HELP); - helpItem.add(ACTION_HELP_ABOUT); + helpItem.add(ACTION_HELP_VIEW_HELP, ACTION_HELP_ABOUT, ACTION_HELP_DONATE); mainMenuItems.add(fileItem); mainMenuItems.add(editItem); mainMenuItems.add(projectItem); @@ -914,6 +912,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL case IDEActions.HelpViewHelp: Platform.instance.openURL(HELP_PAGE_URL); return true; + case IDEActions.HelpDonate: + Platform.instance.openURL(HELP_DONATION_URL); + return true; case IDEActions.HelpAbout: //debug { // testDCDFailAfterThreadCreation(); diff --git a/src/dlangide/ui/homescreen.d b/src/dlangide/ui/homescreen.d index 4013ac3..7c476fa 100644 --- a/src/dlangide/ui/homescreen.d +++ b/src/dlangide/ui/homescreen.d @@ -11,6 +11,10 @@ import dlangui.core.i18n; import std.path; import std.utf : toUTF32; +immutable string HELP_PAGE_URL = "https://github.com/buggins/dlangide/wiki"; +immutable string HELP_DONATION_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ"; + + class HomeScreen : ScrollWidget { protected IDEFrame _frame; protected HorizontalLayout _content; @@ -66,12 +70,13 @@ class HomeScreen : ScrollWidget { _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DUB_REP"c).value, "http://code.dlang.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_UI"c).value, "https://github.com/buggins/dlangui")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE"c).value, "https://github.com/buggins/dlangide")); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_HELP"c).value, HELP_PAGE_URL)); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_TOUR"c).value, "https://tour.dlang.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_VIBED"c).value, "http://vibed.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_FORUM"c).value, "http://forum.dlang.org/")); _column1.addChild(new VSpacer()); _column2.addChild((new TextWidget(null, UIString.fromId("DLANG_IDE_DONATE"c))).fontSize(20).textColor(linkColor)); - _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_DONATE_PAYPAL"c).value, "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ")); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_DONATE_PAYPAL"c).value, HELP_DONATION_URL)); _column2.addChild(new VSpacer()); contentWidget = _content; diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 01867cc..ea8f55e 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -10,11 +10,12 @@ D_LANG=D Programming Language DUB_REP=DUB repository DLANG_UI=DLangUI on GitHub DLANG_IDE=DLangIDE on GitHub +DLANG_IDE_HELP=DLangIDE documentation DLANG_TOUR=DLang Tour DLANG_VIBED=Vibe-D DLANG_FORUM=Dlang Forum -DLANG_IDE_DONATE=Donate DlangIDE -DLANG_IDE_DONATE_PAYPAL=PayPal +DLANG_IDE_DONATE=Support DlangIDE +DLANG_IDE_DONATE_PAYPAL=Donate via PayPal EXIT=Exit ALL_FILES=All files @@ -96,6 +97,7 @@ MENU_WINDOW_SHOW_HOME_SCREEN=Show home screen MENU_HELP=&Help MENU_HELP_VIEW_HELP=&View help MENU_HELP_ABOUT=&About +MENU_HELP_DONATE=Donate via PayPal MENU_VIEW=&View MENU_VIEW_LANGUAGE=Interface &Language diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 4b499bf..82d05cd 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -10,6 +10,7 @@ D_LANG=Язык программирования D DUB_REP=Хранилище DUB DLANG_UI=DLangUI на GitHub DLANG_IDE=DLangIDE на GitHub +DLANG_IDE_HELP=DLangIDE документация DLANG_TOUR=Интерактивный тур D DLANG_VIBED=Vibe-D DLANG_FORUM=Форум D @@ -96,6 +97,7 @@ MENU_WINDOW_SHOW_HOME_SCREEN=Домашняя страница MENU_HELP=&Справка MENU_HELP_VIEW_HELP=&Просмотр справки MENU_HELP_ABOUT=&О программе +MENU_HELP_DONATE=Поддержать проект через PayPal MENU_VIEW=&Вид MENU_VIEW_LANGUAGE=&Язык интерфейса