-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preparation for multiple cloud services: change the UI to show a list of accounts, even though there's only Crowdin for now.
- Loading branch information
Showing
16 changed files
with
195 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,12 +144,15 @@ | |
B29B282119D2E87600D27DC8 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B29B281F19D2E87600D27DC8 /* [email protected] */; }; | ||
B2A012B321BEE4C5008051FD /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B2E7F16F1E04534A005FA992 /* [email protected] */; }; | ||
B2A3637C1E4B9DC800E96253 /* pretranslate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A3637A1E4B9DC800E96253 /* pretranslate.cpp */; }; | ||
B2B5A3652A4B31870045FC33 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B2B5A3622A4B31870045FC33 /* [email protected] */; }; | ||
B2B5A3662A4B31870045FC33 /* AccountCrowdin.png in Resources */ = {isa = PBXBuildFile; fileRef = B2B5A3632A4B31870045FC33 /* AccountCrowdin.png */; }; | ||
B2B5A3672A4B31870045FC33 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B2B5A3642A4B31870045FC33 /* [email protected] */; }; | ||
B2B6065525F100F3006186A9 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2B6065425F100F3006186A9 /* WebKit.framework */; }; | ||
B2B7D472170DD93E00ED0AFE /* GettextTools.bundle in Copy Gettext bundle */ = {isa = PBXBuildFile; fileRef = B248B2DE170D765100EBA58E /* GettextTools.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; | ||
B2B7E81A1AD94194007FC4EB /* libwx_osx_base_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2B7E8191AD94194007FC4EB /* libwx_osx_base_static.a */; }; | ||
B2BC828B20A1F0DC007652D6 /* catalog_po.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2BC828920A1F0DC007652D6 /* catalog_po.cpp */; }; | ||
B2BC828C20A34AB6007652D6 /* catalog_po.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2BC828920A1F0DC007652D6 /* catalog_po.cpp */; }; | ||
B2BCE2E72A44B112005CA5A7 /* accounts_ui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2BCE2E52A44B112005CA5A7 /* accounts_ui.cpp */; }; | ||
B2BCE2E72A44B112005CA5A7 /* cloud_accounts_ui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2BCE2E52A44B112005CA5A7 /* cloud_accounts_ui.cpp */; }; | ||
B2BF84BE170847220030AA22 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF84BD170847220030AA22 /* libz.dylib */; }; | ||
B2BF84C1170847E60030AA22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF84C0170847E60030AA22 /* IOKit.framework */; }; | ||
B2BF84C4170849D00030AA22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BF84BB170846940030AA22 /* Carbon.framework */; }; | ||
|
@@ -515,14 +518,17 @@ | |
B2AEFE131A3210CB003BEFAF /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/InfoPlist.strings; sourceTree = "<group>"; }; | ||
B2AEFE141A3210CB003BEFAF /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/MoveApplication.strings; sourceTree = "<group>"; }; | ||
B2B133431CF7522B009BBA1A /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = json.h; sourceTree = "<group>"; }; | ||
B2B5A3622A4B31870045FC33 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
B2B5A3632A4B31870045FC33 /* AccountCrowdin.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AccountCrowdin.png; sourceTree = "<group>"; }; | ||
B2B5A3642A4B31870045FC33 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
B2B6065425F100F3006186A9 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; | ||
B2B7E8191AD94194007FC4EB /* libwx_osx_base_static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libwx_osx_base_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
B2B814851E82F7B70050DCBF /* ga */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ga; path = ga.lproj/InfoPlist.strings; sourceTree = "<group>"; }; | ||
B2B814861E82F7B80050DCBF /* ga */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ga; path = ga.lproj/MoveApplication.strings; sourceTree = "<group>"; }; | ||
B2BC828920A1F0DC007652D6 /* catalog_po.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = catalog_po.cpp; sourceTree = "<group>"; }; | ||
B2BC828A20A1F0DC007652D6 /* catalog_po.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catalog_po.h; sourceTree = "<group>"; }; | ||
B2BCE2E52A44B112005CA5A7 /* accounts_ui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = accounts_ui.cpp; sourceTree = "<group>"; }; | ||
B2BCE2E62A44B112005CA5A7 /* accounts_ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = accounts_ui.h; sourceTree = "<group>"; }; | ||
B2BCE2E52A44B112005CA5A7 /* cloud_accounts_ui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cloud_accounts_ui.cpp; sourceTree = "<group>"; }; | ||
B2BCE2E62A44B112005CA5A7 /* cloud_accounts_ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cloud_accounts_ui.h; sourceTree = "<group>"; }; | ||
B2BF84BB170846940030AA22 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; | ||
B2BF84BD170847220030AA22 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; | ||
B2BF84C0170847E60030AA22 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; | ||
|
@@ -743,14 +749,14 @@ | |
isa = PBXGroup; | ||
children = ( | ||
B25504A51A2201CC00EE2CEE /* Native */, | ||
B2BCE2E52A44B112005CA5A7 /* accounts_ui.cpp */, | ||
B2BCE2E62A44B112005CA5A7 /* accounts_ui.h */, | ||
B28F1CB116F629D30018AF7E /* attentionbar.cpp */, | ||
B28F1CB216F629D30018AF7E /* attentionbar.h */, | ||
B28F1CD616F629D30018AF7E /* cat_update.cpp */, | ||
B28F1CD716F629D30018AF7E /* cat_update.h */, | ||
B28F1CB316F629D30018AF7E /* cat_sorting.cpp */, | ||
B28F1CB416F629D30018AF7E /* cat_sorting.h */, | ||
B2BCE2E52A44B112005CA5A7 /* cloud_accounts_ui.cpp */, | ||
B2BCE2E62A44B112005CA5A7 /* cloud_accounts_ui.h */, | ||
B28F1CB616F629D30018AF7E /* chooselang.cpp */, | ||
B28F1CAD16F629D30018AF7E /* chooselang.h */, | ||
B28602421DDB279400FCA617 /* colorscheme.cpp */, | ||
|
@@ -1034,6 +1040,9 @@ | |
B2B1EB0619E45FE7009A59B7 /* Toolbar */, | ||
B2166F4019AE4024000A6AA0 /* Preferences */, | ||
B24ACD8316F6263900399242 /* Poedit.iconset */, | ||
B2B5A3632A4B31870045FC33 /* AccountCrowdin.png */, | ||
B2B5A3642A4B31870045FC33 /* [email protected] */, | ||
B2B5A3622A4B31870045FC33 /* [email protected] */, | ||
B26E2C8D25A245BD008D6DF1 /* CloseButtonHoverTemplate.png */, | ||
B26E2C8A25A245BC008D6DF1 /* [email protected] */, | ||
B26E2C8C25A245BC008D6DF1 /* CloseButtonTemplate.png */, | ||
|
@@ -1269,6 +1278,7 @@ | |
B26E2C8E25A245BD008D6DF1 /* [email protected] in Resources */, | ||
B290F9E32166543800741842 /* [email protected] in Resources */, | ||
B292667421664C9500DC536C /* ItemCommentTemplate.png in Resources */, | ||
B2B5A3662A4B31870045FC33 /* AccountCrowdin.png in Resources */, | ||
B290F9E42166543800741842 /* DownvoteTemplate.png in Resources */, | ||
B29AE89017103992008D1F8A /* comment.xrc in Resources */, | ||
B26E2C8F25A245BD008D6DF1 /* [email protected] in Resources */, | ||
|
@@ -1279,6 +1289,7 @@ | |
B2CE2FEB1A94EBDE0020A620 /* CrowdinLogoTemplate.png in Resources */, | ||
B2CE2FF21A94F19D0020A620 /* Prefs-Accounts.png in Resources */, | ||
B2E3EE4E256D658500FCE1BF /* Prefs-Advanced.png in Resources */, | ||
B2B5A3672A4B31870045FC33 /* [email protected] in Resources */, | ||
B29B282119D2E87600D27DC8 /* [email protected] in Resources */, | ||
B2D52B861DE88A3D00E27B35 /* SuggestionPerfectMatch.png in Resources */, | ||
B29AE89217103992008D1F8A /* manager.xrc in Resources */, | ||
|
@@ -1295,6 +1306,7 @@ | |
B24D196A1E84503B00C6DD8D /* [email protected] in Resources */, | ||
B26897B4197A830200B42764 /* MoveApplication.strings in Resources */, | ||
B292667521664C9500DC536C /* [email protected] in Resources */, | ||
B2B5A3652A4B31870045FC33 /* [email protected] in Resources */, | ||
B22A5C82184E4B870034BEFD /* [email protected] in Resources */, | ||
B2166F4B19AE4045000A6AA0 /* Prefs-General.png in Resources */, | ||
B209005E19CAD64400D6382E /* SuggestionTMTemplate.png in Resources */, | ||
|
@@ -1511,7 +1523,7 @@ | |
B28F1D0016F629D30018AF7E /* export_html.cpp in Sources */, | ||
B230E2281A73F81400FB1E57 /* hidpi.cpp in Sources */, | ||
B280E84D1A92776D009F4A98 /* http_client_macos.mm in Sources */, | ||
B2BCE2E72A44B112005CA5A7 /* accounts_ui.cpp in Sources */, | ||
B2BCE2E72A44B112005CA5A7 /* cloud_accounts_ui.cpp in Sources */, | ||
B22C5F0A17DDC67400ECAFD1 /* language.cpp in Sources */, | ||
B2E2184C199A76B100EA2784 /* syntaxhighlighter.cpp in Sources */, | ||
B26E2C8625A24541008D6DF1 /* menus.cpp in Sources */, | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* This file is part of Poedit (https://poedit.net) | ||
* | ||
* Copyright (C) 2023 Vaclav Slavik | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
* DEALINGS IN THE SOFTWARE. | ||
* | ||
*/ | ||
|
||
#include "cloud_accounts_ui.h" | ||
|
||
#ifdef HAVE_HTTP_CLIENT | ||
|
||
#include "customcontrols.h" | ||
#include "crowdin_client.h" | ||
#include "crowdin_gui.h" | ||
#include "utility.h" | ||
|
||
#include <wx/simplebook.h> | ||
#include <wx/sizer.h> | ||
|
||
|
||
AccountsPanel::AccountsPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) | ||
{ | ||
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); | ||
SetSizer(sizer); | ||
|
||
m_list = new IconAndSubtitleListCtrl(this, _("Account"), MSW_OR_OTHER(wxBORDER_SIMPLE, wxBORDER_SUNKEN)); | ||
sizer->Add(m_list, wxSizerFlags().Expand().Border(wxRIGHT, PX(10))); | ||
|
||
m_panelsBook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | MSW_OR_OTHER(wxBORDER_SIMPLE, wxBORDER_SUNKEN)); | ||
ColorScheme::SetupWindowColors(m_panelsBook, [=] | ||
{ | ||
if (ColorScheme::GetWindowMode(m_panelsBook) == ColorScheme::Light) | ||
m_panelsBook->SetBackgroundColour(*wxWHITE); | ||
else | ||
m_panelsBook->SetBackgroundColour(wxNullColour); | ||
}); | ||
|
||
sizer->Add(m_panelsBook, wxSizerFlags(1).Expand()); | ||
|
||
AddAccount("Crowdin", "AccountCrowdin", new CrowdinLoginPanel(m_panelsBook)); | ||
|
||
m_list->SetMinSize(wxSize(PX(180), -1)); | ||
m_panelsBook->SetMinSize(wxSize(PX(320), -1)); | ||
|
||
m_list->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &AccountsPanel::OnSelectAccount, this); | ||
} | ||
|
||
|
||
void AccountsPanel::InitializeAfterShown() | ||
{ | ||
for (auto& p: m_panels) | ||
p->EnsureInitialized(); | ||
} | ||
|
||
|
||
void AccountsPanel::AddAccount(const wxString& name, const wxString& iconId, AccountDetailPanel *panel) | ||
{ | ||
auto pos = (unsigned)m_panels.size(); | ||
m_panels.push_back(panel); | ||
m_panelsBook->AddPage(panel, ""); | ||
|
||
m_list->AppendFormattedItem(wxArtProvider::GetBitmap(iconId), name, " ... "); | ||
|
||
panel->OnContentChanged = [=]{ | ||
wxString desc = panel->IsSignedIn() ? panel->GetLoginName() : _("(not signed in)"); | ||
m_list->UpdateFormattedItem(pos, name, desc); | ||
}; | ||
} | ||
|
||
|
||
void AccountsPanel::OnSelectAccount(wxDataViewEvent& event) | ||
{ | ||
auto index = m_list->ItemToRow(event.GetItem()); | ||
if (index == wxNOT_FOUND || index >= (int)m_panels.size()) | ||
return; | ||
|
||
m_panelsBook->SetSelection(index); | ||
} | ||
|
||
|
||
#endif // #ifdef HAVE_HTTP_CLIENT |
Oops, something went wrong.