Skip to content

Commit e31b0e3

Browse files
committed
Add "DisplayName" attribute to servers.xml; help buttons icon
* Server List Popup: add OK button, search icon, help button icon * CScreenRecordingSettingsPage: add help button icon
1 parent 8d2e485 commit e31b0e3

20 files changed

+102
-33
lines changed

Data/servers.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
</Actions>
8484
<Result ImageUrlTemplate="$(Image)" ThumbUrlTemplate="$(Thumb)" DownloadUrlTemplate="$(View)"/>
8585
</Server>
86-
<Server Name="directupload.net" Authorize="1" MaxFileSize="67108864" DefaultForTypes="image" Plugin="directupload" SupportsFolders="1"
86+
<Server Name="directupload.net" DisplayName="directupload.eu" Authorize="1" MaxFileSize="67108864" DefaultForTypes="image" Plugin="directupload" SupportsFolders="1"
8787
WebsiteUrl="https://www.directupload.eu" RegistrationUrl="https://www.directupload.eu/index.php?mode=register">
8888
<Info>
8989
<SupportedFormats>
@@ -127,7 +127,7 @@
127127
</Info>
128128
<Result ImageUrlTemplate="stub" />
129129
</Server>
130-
<Server Name="fastpic.ru" MaxFileSize="26214400" Debug="0" Plugin="fastpic" WebsiteUrl="https://fastpic.org">
130+
<Server Name="fastpic.ru" DisplayName="fastpic.org" MaxFileSize="26214400" Debug="0" Plugin="fastpic" WebsiteUrl="https://fastpic.org">
131131
<Info>
132132
<SupportedFormats>
133133
<FormatGroup>

Data/servers.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
</xs:element>
227227
</xs:all>
228228
<xs:attribute type="xs:string" name="Name" use="required"/>
229+
<xs:attribute type="xs:string" name="DisplayName" use="optional"/>
229230
<xs:attribute type="xs:integer" name="MaxFileSize" use="optional"/>
230231
<xs:attribute type="Bool" name="Debug" use="optional"/>
231232
<xs:attribute type="AuthorizeType" name="Authorize" use="optional"/>

Docs/ru/server.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ <h3 id="основные-атрибуты">Основные атрибуты</h3
111111
<th>Описание</th>
112112
</tr>
113113
</thead>
114-
<tbody><tr>
114+
<tbody>
115+
<tr>
116+
<td><code>DisplayName</code></td>
117+
<td>текст</td>
118+
<td>Отображаемое имя сервера (версия ≥ 1.4.6)</td>
119+
</tr>
120+
<tr>
115121
<td><code>Type</code></td>
116122
<td><code>image</code>, <code>file</code>, <code>urlshortening</code>, <code>searchbyimage</code></td>
117123
<td>Тип сервера</td>

Source/Core/Settings/BasicSettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void BasicSettings::deleteProfile(const std::string& serverName, const std::stri
227227
}
228228

229229
void BasicSettings::clearServerSettings() {
230-
auto builtInScripts = CUploadEngineListBase::builtInScripts();
230+
//auto builtInScripts = CUploadEngineListBase::builtInScripts();
231231

232232
std::vector<std::string> deletedServerProfiles;
233233

Source/Core/Upload/UploadEngine.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ std::string CUploadEngineListBase::getDefaultServerNameForType(CUploadEngineData
285285
return {};
286286
}
287287

288-
std::vector<std::string> CUploadEngineListBase::builtInScripts() {
289-
auto keys = { CORE_SCRIPT_FTP, CORE_SCRIPT_SFTP, CORE_SCRIPT_WEBDAV, CORE_SCRIPT_DIRECTORY };
290-
return std::vector<std::string>(keys.begin(), keys.end());
288+
std::vector<std::string_view> CUploadEngineListBase::builtInScripts() {
289+
return BUILTIN_SCRIPTS;
291290
}
292291

293292
void CUploadEngineListBase::removeServer(const std::string& name) {
@@ -308,10 +307,10 @@ std::string CUploadEngineListBase::getServerDisplayName(const CUploadEngineData*
308307
if (!data) {
309308
return {};
310309
}
311-
std::string serverName = data->Name;
312-
auto builtInScriptList = builtInScripts();
313310

314-
if (std::find(builtInScriptList.begin(), builtInScriptList.end(), data->PluginName) != builtInScriptList.end()) {
311+
std::string serverName = data->DisplayName.empty() ? data->Name : data->DisplayName;
312+
313+
if (std::find(BUILTIN_SCRIPTS.begin(), BUILTIN_SCRIPTS.end(), data->PluginName) != BUILTIN_SCRIPTS.end()) {
315314
serverName = IuStringUtils::Replace(serverName, "(" + data->PluginName + ")", "[" + IuStringUtils::ToUpper(data->PluginName) + "]");
316315
}
317316
return serverName;

Source/Core/Upload/UploadEngine.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ class CUploadEngineData
212212
enum NeedAuthorizationEnum { naNotAvailable = 0, naAvailable, naObligatory };
213213
inline static constexpr int MAX_FILE_SIZE_UNLIMITED = -1;
214214
std::string Name;
215+
std::string DisplayName;
215216
std::string PluginName;
216217
bool SupportsFolders;
217218
bool UsingPlugin;
@@ -397,7 +398,7 @@ class CUploadEngineListBase
397398
std::vector<std::unique_ptr<CUploadEngineData>>::const_iterator begin() const;
398399
std::vector<std::unique_ptr<CUploadEngineData>>::const_iterator end() const;
399400
std::string getDefaultServerNameForType(CUploadEngineData::ServerType serverType) const;
400-
static std::vector<std::string> builtInScripts();
401+
static std::vector<std::string_view> builtInScripts();
401402
std::string getServerDisplayName(const CUploadEngineData* data) const;
402403

403404
inline static constexpr std::string_view CORE_SCRIPT_FTP = "ftp";
@@ -406,6 +407,7 @@ class CUploadEngineListBase
406407
inline static constexpr std::string_view CORE_SCRIPT_DIRECTORY = "directory";
407408

408409
inline static constexpr int ALL_SERVERS = 0xffffffff;
410+
inline static std::vector<std::string_view> BUILTIN_SCRIPTS = { CORE_SCRIPT_FTP, CORE_SCRIPT_SFTP, CORE_SCRIPT_WEBDAV, CORE_SCRIPT_DIRECTORY };
409411

410412
protected:
411413
std::vector<std::unique_ptr<CUploadEngineData>> m_list;

Source/Core/UploadEngineList.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ bool CUploadEngineList::loadFromFile(const std::string& filename, ServerSettings
9191
}
9292

9393
UE.Name = cur.Attribute("Name");
94+
UE.DisplayName = cur.Attribute("DisplayName");
9495
//#ifdef NDEBUG
9596
std::string serverMinVersion = cur.Attribute("MinVersion");
9697
if (!serverMinVersion.empty()) {

Source/Func/Common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void OpenDocumentation(HWND parent, const CString& file, const CString& id /*= {
304304
}*/
305305
}
306306

307-
if (file.IsEmpty()) {
307+
if (actualFile.IsEmpty()) {
308308
actualFile = docsFolder + _T("index.html");
309309
}
310310

Source/GUI.rc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
4949
BEGIN
5050
CTEXT "#backend",IDC_BACKENDLABEL,7,9,94,10
5151
COMBOBOX IDC_BACKENDCOMBO,108,8,125,59,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
52-
PUSHBUTTON "?",IDC_HELPBUTTON,239,7,21,14
52+
PUSHBUTTON "?",IDC_HELPBUTTON,241,7,19,14,BS_ICON
5353
LTEXT "#out folder",IDC_OUTFOLDERLABEL,7,26,191,8
5454
EDITTEXT IDC_OUTFOLDEREDIT,7,38,189,14,ES_AUTOHSCROLL
5555
PUSHBUTTON "#browse",IDC_OUTFOLDERBROWSEBUTTON,199,38,61,14
@@ -162,8 +162,10 @@ BEGIN
162162
CONTROL "#video",IDC_VIDEORADIO,"Button",BS_AUTORADIOBUTTON,226,2,75,10
163163
CONTROL "",IDC_SERVERLISTCONTROL,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,6,15,461,206
164164
EDITTEXT IDC_SEARCHQUERYEDIT,6,224,129,14,ES_AUTOHSCROLL
165-
PUSHBUTTON "#add",IDC_ADDBUTTON,363,224,96,14
166-
PUSHBUTTON "?",IDC_HELPBUTTON,451,-1,17,14
165+
DEFPUSHBUTTON "#ok",IDOK,270,224,89,14
166+
PUSHBUTTON "#add",IDC_ADDBUTTON,365,224,96,14
167+
PUSHBUTTON "?",IDC_HELPBUTTON,451,-1,17,14,BS_ICON
168+
ICON "",IDC_SEARCHSTATIC,138,226,18,16,SS_REALSIZEIMAGE
167169
END
168170

169171
IDD_SERVERSELECTORCONTROL DIALOGEX 0, 0, 260, 46
@@ -396,6 +398,8 @@ IDB_ICONOK PNG "res\\icon_ok.png"
396398

397399
IDB_ICONCANCEL PNG "res\\icon_cancel.png"
398400

401+
IDB_ICONSEARCHSMALL PNG "res\\icon_search.png"
402+
399403

400404
/////////////////////////////////////////////////////////////////////////////
401405
//

Source/Gui/Dialogs/ContextMenuItemDlg.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ void CContextMenuItemDlg::generateTitle()
120120
{
121121
if ( !titleEdited_ ) {
122122
ServerProfile sp = imageServerSelector_->serverProfile();
123-
std::wstring serverName = IuCoreUtils::Utf8ToWstring(sp.serverName());
123+
auto engineList = ServiceLocator::instance()->engineList();
124+
CUploadEngineData* ued = engineList->byName(sp.serverName());
125+
std::wstring serverName = IuCoreUtils::Utf8ToWstring(engineList->getServerDisplayName(ued));
124126
std::wstring title = str(boost::wformat(TR("Upload to %s")) % serverName);
125127

126128
std::wstring additional;

0 commit comments

Comments
 (0)