1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-05 11:34:07 +02:00

Stop using BrandName in msg dialogs, update msg titles, fix mistakes from prev commits

This commit is contained in:
chylex 2017-07-09 04:21:33 +02:00
parent 7538aee4f2
commit 441228e2b0
15 changed files with 35 additions and 29 deletions

View File

@ -102,7 +102,7 @@ public void Alert(string type, string contents){
default: icon = MessageBoxIcon.None; break; default: icon = MessageBoxIcon.None; break;
} }
FormMessage.Show(Program.BrandName+" Browser Message", contents, icon, FormMessage.OK); FormMessage.Show("TweetDuck Browser Message", contents, icon, FormMessage.OK);
} }
public void CrashDebug(string message){ public void CrashDebug(string message){

View File

@ -81,7 +81,7 @@ public virtual bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser br
if (saveTarget != null){ if (saveTarget != null){
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, null, ex => { BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, null, ex => {
FormMessage.Error(Program.BrandName+" Has Failed :(", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK); FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
}); });
} }

View File

@ -9,17 +9,20 @@ namespace TweetDuck.Core.Handling {
class JavaScriptDialogHandler : IJsDialogHandler{ class JavaScriptDialogHandler : IJsDialogHandler{
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){ bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
((ChromiumWebBrowser)browserControl).InvokeSafe(() => { ((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
FormMessage form = new FormMessage(Program.BrandName, messageText, MessageBoxIcon.None); FormMessage form;
TextBox input = null; TextBox input = null;
if (dialogType == CefJsDialogType.Alert){ if (dialogType == CefJsDialogType.Alert){
form = new FormMessage("TweetDuck Browser Message", messageText, MessageBoxIcon.None);
form.AddButton(FormMessage.OK, ControlType.Accept | ControlType.Focused); form.AddButton(FormMessage.OK, ControlType.Accept | ControlType.Focused);
} }
else if (dialogType == CefJsDialogType.Confirm){ else if (dialogType == CefJsDialogType.Confirm){
form = new FormMessage("TweetDuck Browser Confirmation", messageText, MessageBoxIcon.None);
form.AddButton(FormMessage.No, DialogResult.No, ControlType.Cancel); form.AddButton(FormMessage.No, DialogResult.No, ControlType.Cancel);
form.AddButton(FormMessage.Yes, ControlType.Focused); form.AddButton(FormMessage.Yes, ControlType.Focused);
} }
else if (dialogType == CefJsDialogType.Prompt){ else if (dialogType == CefJsDialogType.Prompt){
form = new FormMessage("TweetDuck Browser Prompt", messageText, MessageBoxIcon.None);
form.AddButton(FormMessage.Cancel, DialogResult.Cancel, ControlType.Cancel); form.AddButton(FormMessage.Cancel, DialogResult.Cancel, ControlType.Cancel);
form.AddButton(FormMessage.OK, ControlType.Accept | ControlType.Focused); form.AddButton(FormMessage.OK, ControlType.Accept | ControlType.Focused);
@ -33,6 +36,10 @@ bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, s
form.ActiveControl = input; form.ActiveControl = input;
form.Height += input.Size.Height+input.Margin.Vertical; form.Height += input.Size.Height+input.Margin.Vertical;
} }
else{
callback.Continue(false);
return;
}
bool success = form.ShowDialog() == DialogResult.OK; bool success = form.ShowDialog() == DialogResult.OK;

View File

@ -11,7 +11,7 @@ public FormAbout(){
Text = "About "+Program.BrandName+" "+Program.VersionTag; Text = "About "+Program.BrandName+" "+Program.VersionTag;
labelDescription.Text = Program.BrandName+" was created by chylex as a replacement to the discontinued official TweetDeck client for Windows.\n\nThe program is available for free under the open source MIT license."; labelDescription.Text = "TweetDuck was created by chylex as a replacement to the discontinued official TweetDeck client for Windows.\n\nThe program is available for free under the open source MIT license.";
labelWebsite.Links.Add(new LinkLabel.Link(0, labelWebsite.Text.Length, Program.Website)); labelWebsite.Links.Add(new LinkLabel.Link(0, labelWebsite.Text.Length, Program.Website));
labelTips.Links.Add(new LinkLabel.Link(0, labelTips.Text.Length, TipsLink)); labelTips.Links.Add(new LinkLabel.Link(0, labelTips.Text.Length, TipsLink));

View File

@ -25,7 +25,7 @@ public virtual void OnReady(){}
public virtual void OnClosing(){} public virtual void OnClosing(){}
protected static void PromptRestart(){ protected static void PromptRestart(){
if (FormMessage.Information(Program.BrandName+" Options", "The application must restart for the option to take place. Do you want to restart now?", FormMessage.Yes, FormMessage.No)){ if (FormMessage.Information("TweetDuck Options", "The application must restart for the option to take place. Do you want to restart now?", FormMessage.Yes, FormMessage.No)){
Program.Restart(); Program.Restart();
} }
} }

View File

@ -58,7 +58,7 @@ private void btnContinue_Click(object sender, EventArgs e){
case State.Deciding: case State.Deciding:
// Reset // Reset
if (radioReset.Checked){ if (radioReset.Checked){
if (FormMessage.Warning("Reset "+Program.BrandName+" Options", "This will reset all of your program options. Plugins will not be affected. Do you want to proceed?", FormMessage.Yes, FormMessage.No)){ if (FormMessage.Warning("Reset TweetDuck Options", "This will reset all of your program options. Plugins will not be affected. Do you want to proceed?", FormMessage.Yes, FormMessage.No)){
Program.ResetConfig(); Program.ResetConfig();
ShouldReloadUI = true; ShouldReloadUI = true;
@ -74,8 +74,8 @@ private void btnContinue_Click(object sender, EventArgs e){
using(OpenFileDialog dialog = new OpenFileDialog{ using(OpenFileDialog dialog = new OpenFileDialog{
AutoUpgradeEnabled = true, AutoUpgradeEnabled = true,
DereferenceLinks = true, DereferenceLinks = true,
Title = "Import "+Program.BrandName+" Profile", Title = "Import TweetDuck Profile",
Filter = Program.BrandName+" Profile (*.tdsettings)|*.tdsettings" Filter = "TweetDuck Profile (*.tdsettings)|*.tdsettings"
}){ }){
if (dialog.ShowDialog() != DialogResult.OK){ if (dialog.ShowDialog() != DialogResult.OK){
return; return;
@ -116,7 +116,7 @@ private void btnContinue_Click(object sender, EventArgs e){
} }
} }
else{ else{
Program.Reporter.HandleException("Profile Import Error", "An exception happened while importing "+Program.BrandName+" profile.", true, importManager.LastException); Program.Reporter.HandleException("Profile Import Error", "An exception happened while importing TweetDuck profile.", true, importManager.LastException);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
@ -129,9 +129,9 @@ private void btnContinue_Click(object sender, EventArgs e){
AutoUpgradeEnabled = true, AutoUpgradeEnabled = true,
OverwritePrompt = true, OverwritePrompt = true,
DefaultExt = "tdsettings", DefaultExt = "tdsettings",
FileName = Program.BrandName+".tdsettings", FileName = "TweetDuck.tdsettings",
Title = "Export "+Program.BrandName+" Profile", Title = "Export TweetDuck Profile",
Filter = Program.BrandName+" Profile (*.tdsettings)|*.tdsettings" Filter = "TweetDuck Profile (*.tdsettings)|*.tdsettings"
}){ }){
if (dialog.ShowDialog() != DialogResult.OK){ if (dialog.ShowDialog() != DialogResult.OK){
return; return;
@ -144,7 +144,7 @@ private void btnContinue_Click(object sender, EventArgs e){
ExportManager manager = new ExportManager(file, plugins); ExportManager manager = new ExportManager(file, plugins);
if (!manager.Export(Flags)){ if (!manager.Export(Flags)){
Program.Reporter.HandleException("Profile Export Error", "An exception happened while exporting "+Program.BrandName+" profile.", true, manager.LastException); Program.Reporter.HandleException("Profile Export Error", "An exception happened while exporting TweetDuck profile.", true, manager.LastException);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -138,7 +138,7 @@ public bool Import(ExportFileFlags flags){
} }
if (missingPlugins.Count > 0){ if (missingPlugins.Count > 0){
FormMessage.Information("Importing "+Program.BrandName+" Profile", "Detected missing plugins when importing plugin data:\n"+string.Join("\n", missingPlugins), FormMessage.OK); FormMessage.Information("Importing TweetDuck Profile", "Detected missing plugins when importing plugin data:\n"+string.Join("\n", missingPlugins), FormMessage.OK);
} }
if (IsRestarting){ if (IsRestarting){

View File

@ -56,7 +56,7 @@ public override void OnReady(){
private void btnClearCache_Click(object sender, EventArgs e){ private void btnClearCache_Click(object sender, EventArgs e){
btnClearCache.Enabled = false; btnClearCache.Enabled = false;
BrowserCache.SetClearOnExit(); BrowserCache.SetClearOnExit();
FormMessage.Information("Clear Cache", "Cache will be automatically cleared when "+Program.BrandName+" exits.", FormMessage.OK); FormMessage.Information("Clear Cache", "Cache will be automatically cleared when TweetDuck exits.", FormMessage.OK);
} }
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){ private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){

View File

@ -102,7 +102,7 @@ private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
btnCheckUpdates.Enabled = true; btnCheckUpdates.Enabled = true;
if (!e.UpdateAvailable){ if (!e.UpdateAvailable){
FormMessage.Information("No Updates Available", "Your version of "+Program.BrandName+" is up to date.", FormMessage.OK); FormMessage.Information("No Updates Available", "Your version of TweetDuck is up to date.", FormMessage.OK);
} }
} }
}); });

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
@ -52,7 +51,7 @@ public TabSettingsNotifications(FormNotificationMain notification){
comboBoxIdlePause.Items.Add("5 minutes"); comboBoxIdlePause.Items.Add("5 minutes");
comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds)); comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds));
comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")"); comboBoxDisplay.Items.Add("(Same as TweetDuck)");
foreach(Screen screen in Screen.AllScreens){ foreach(Screen screen in Screen.AllScreens){
comboBoxDisplay.Items.Add(screen.DeviceName.TrimStart('\\', '.')+" ("+screen.Bounds.Width+"x"+screen.Bounds.Height+")"); comboBoxDisplay.Items.Add(screen.DeviceName.TrimStart('\\', '.')+" ("+screen.Bounds.Width+"x"+screen.Bounds.Height+")");

View File

@ -125,7 +125,7 @@ private static void SetClipboardData(DataObject obj){
try{ try{
Clipboard.SetDataObject(obj); Clipboard.SetDataObject(obj);
}catch(ExternalException e){ }catch(ExternalException e){
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e); Program.Reporter.HandleException("Clipboard Error", "TweetDuck could not access the clipboard as it is currently used by another process.", true, e);
} }
} }
} }

View File

@ -25,7 +25,7 @@ public PluginControl(PluginManager pluginManager, Plugin plugin) : this(){
this.dpiScale = this.GetDPIScale(); this.dpiScale = this.GetDPIScale();
this.labelName.Text = plugin.Name; this.labelName.Text = plugin.Name;
this.labelDescription.Text = plugin.CanRun ? plugin.Description : "This plugin requires "+Program.BrandName+" "+plugin.RequiredVersion+" or newer."; this.labelDescription.Text = plugin.CanRun ? plugin.Description : "This plugin requires TweetDuck "+plugin.RequiredVersion+" or newer.";
this.labelVersion.Text = plugin.Version; this.labelVersion.Text = plugin.Version;
this.labelAuthor.Text = plugin.Author; this.labelAuthor.Text = plugin.Author;
this.labelWebsite.Text = plugin.Website; this.labelWebsite.Text = plugin.Website;

View File

@ -49,7 +49,7 @@ private string GetFullPathOrThrow(int token, PluginFolder folder, string path){
switch(folder){ switch(folder){
case PluginFolder.Data: throw new ArgumentException("File path has to be relative to the plugin data folder."); case PluginFolder.Data: throw new ArgumentException("File path has to be relative to the plugin data folder.");
case PluginFolder.Root: throw new ArgumentException("File path has to be relative to the plugin root folder."); case PluginFolder.Root: throw new ArgumentException("File path has to be relative to the plugin root folder.");
default: throw new ArgumentException("Invalid folder type "+folder+", this is a "+Program.BrandName+" error."); default: throw new ArgumentException("Invalid folder type "+folder+", this is a TweetDuck error.");
} }
} }
else{ else{

View File

@ -63,7 +63,7 @@ static Program(){
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
Reporter = new Reporter(ErrorLogFilePath); Reporter = new Reporter(ErrorLogFilePath);
Reporter.SetupUnhandledExceptionHandler(BrandName+" Has Failed :("); Reporter.SetupUnhandledExceptionHandler("TweetDuck Has Failed :(");
} }
[STAThread] [STAThread]
@ -75,7 +75,7 @@ private static void Main(){
SubProcessMessage = NativeMethods.RegisterWindowMessage("TweetDuckSubProcess"); SubProcessMessage = NativeMethods.RegisterWindowMessage("TweetDuckSubProcess");
if (!WindowsUtils.CheckFolderWritePermission(StoragePath)){ if (!WindowsUtils.CheckFolderWritePermission(StoragePath)){
FormMessage.Warning("Permission Error", BrandName+" does not have write permissions to the storage folder: "+StoragePath, FormMessage.OK); FormMessage.Warning("Permission Error", "TweetDuck does not have write permissions to the storage folder: "+StoragePath, FormMessage.OK);
return; return;
} }
@ -87,11 +87,11 @@ private static void Main(){
break; break;
} }
else if (lockResult == LockManager.Result.Fail){ else if (lockResult == LockManager.Result.Fail){
FormMessage.Error(BrandName+" Has Failed :(", "An unknown error occurred accessing the data folder. Please, make sure "+BrandName+" is not already running. If the problem persists, try restarting your system.", FormMessage.OK); FormMessage.Error("TweetDuck Has Failed :(", "An unknown error occurred accessing the data folder. Please, make sure TweetDuck is not already running. If the problem persists, try restarting your system.", FormMessage.OK);
return; return;
} }
else if (attempt == 20){ else if (attempt == 20){
if (FormMessage.Warning(BrandName+" Cannot Restart", BrandName+" is taking too long to close.", FormMessage.Retry, FormMessage.Exit)){ if (FormMessage.Warning("TweetDuck Cannot Restart", "TweetDuck is taking too long to close.", FormMessage.Retry, FormMessage.Exit)){
attempt /= 2; attempt /= 2;
continue; continue;
} }
@ -116,9 +116,9 @@ private static void Main(){
} }
} }
if (FormMessage.Error(BrandName+" is Already Running", "Another instance of "+BrandName+" is already running.\nDo you want to close it?", FormMessage.Yes, FormMessage.No)){ if (FormMessage.Error("TweetDuck is Already Running", "Another instance of TweetDuck is already running.\nDo you want to close it?", FormMessage.Yes, FormMessage.No)){
if (!LockManager.CloseLockingProcess(10000, 5000)){ if (!LockManager.CloseLockingProcess(10000, 5000)){
FormMessage.Error(BrandName+" Has Failed :(", "Could not close the other process.", FormMessage.OK); FormMessage.Error("TweetDuck Has Failed :(", "Could not close the other process.", FormMessage.OK);
return; return;
} }
@ -127,7 +127,7 @@ private static void Main(){
else return; else return;
} }
else if (lockResult != LockManager.Result.Success){ else if (lockResult != LockManager.Result.Success){
FormMessage.Error(BrandName+" Has Failed :(", "An unknown error occurred accessing the data folder. Please, make sure "+BrandName+" is not already running. If the problem persists, try restarting your system.", BrandName+" Has Failed :(", FormMessage.OK); FormMessage.Error("TweetDuck Has Failed :(", "An unknown error occurred accessing the data folder. Please, make sure TweetDuck is not already running. If the problem persists, try restarting your system.", FormMessage.OK);
return; return;
} }
} }

View File

@ -14,7 +14,7 @@ public static string LoadResource(string name, bool silent = false){
return File.ReadAllText(Path.Combine(Program.ScriptPath, name), Encoding.UTF8); return File.ReadAllText(Path.Combine(Program.ScriptPath, name), Encoding.UTF8);
}catch(Exception ex){ }catch(Exception ex){
if (!silent){ if (!silent){
FormMessage.Error(Program.BrandName+" Has Failed :(", "Unfortunately, "+Program.BrandName+" could not load the "+name+" file. The program will continue running with limited functionality.\n\n"+ex.Message, FormMessage.OK); FormMessage.Error("TweetDuck Has Failed :(", "Unfortunately, TweetDuck could not load the "+name+" file. The program will continue running with limited functionality.\n\n"+ex.Message, FormMessage.OK);
} }
return null; return null;