Skip to content

Commit

Permalink
+ resend confirmation code
Browse files Browse the repository at this point in the history
+ tooltip is not disabled when parameter is disabled
  • Loading branch information
chrxh committed Jul 9, 2023
1 parent 0432f93 commit 17217be
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 3 deletions.
25 changes: 25 additions & 0 deletions source/Gui/ActivateUserDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "MessageDialog.h"
#include "NetworkController.h"
#include "BrowserWindow.h"
#include "CreateUserDialog.h"
#include "StyleRepository.h"

_ActivateUserDialog::_ActivateUserDialog(BrowserWindow const& browserWindow, NetworkController const& networkController)
: _browserWindow(browserWindow)
Expand All @@ -15,6 +17,11 @@ _ActivateUserDialog::_ActivateUserDialog(BrowserWindow const& browserWindow, Net

_ActivateUserDialog::~_ActivateUserDialog() {}

void _ActivateUserDialog::registerCyclicReferences(CreateUserDialogWeakPtr const& createUserDialog)
{
_createUserDialog = createUserDialog;
}

void _ActivateUserDialog::process()
{
if (!_show) {
Expand All @@ -41,6 +48,24 @@ void _ActivateUserDialog::process()
ImGui::EndDisabled();
ImGui::SetItemDefaultFocus();

ImGui::SameLine();
AlienImGui::VerticalSeparator();

ImGui::SameLine();
if (AlienImGui::Button("Resend")) {
_createUserDialog.lock()->onCreateUser();
}

ImGui::SameLine();
if (AlienImGui::Button("Resend to other email address")) {
ImGui::CloseCurrentPopup();
_show = false;
_createUserDialog.lock()->show(_userName, _password);
}

ImGui::SameLine();
AlienImGui::VerticalSeparator();

ImGui::SameLine();
if (AlienImGui::Button("Cancel")) {
ImGui::CloseCurrentPopup();
Expand Down
3 changes: 3 additions & 0 deletions source/Gui/ActivateUserDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class _ActivateUserDialog
_ActivateUserDialog(BrowserWindow const& browserWindow, NetworkController const& networkController);
~_ActivateUserDialog();

void registerCyclicReferences(CreateUserDialogWeakPtr const& createUserDialog);

void process();

void show(std::string const& userName, std::string const& password);
Expand All @@ -17,6 +19,7 @@ class _ActivateUserDialog

BrowserWindow _browserWindow;
NetworkController _networkController;
CreateUserDialogWeakPtr _createUserDialog;

bool _show = false;
std::string _userName;
Expand Down
6 changes: 6 additions & 0 deletions source/Gui/AlienImGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,13 @@ bool AlienImGui::BasicSlider(Parameter const& parameters, T* value, bool* enable

//tooltip
if (parameters._tooltip) {
if (enabled) {
ImGui::EndDisabled();
}
AlienImGui::HelpMarker(*parameters._tooltip);
if (enabled) {
ImGui::BeginDisabled(!(*enabled));
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/Gui/CreateUserDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class _CreateUserDialog

void show(std::string const& userName, std::string const& password);

private:
void onCreateUser();
private:

NetworkController _networkController;
ActivateUserDialog _activateUserDialog;
Expand Down
1 change: 1 addition & 0 deletions source/Gui/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ using UploadSimulationDialogWeakPtr = std::weak_ptr<_UploadSimulationDialog>;

class _CreateUserDialog;
using CreateUserDialog = std::shared_ptr<_CreateUserDialog>;
using CreateUserDialogWeakPtr = std::weak_ptr<_CreateUserDialog>;

class _ActivateUserDialog;
using ActivateUserDialog = std::shared_ptr<_ActivateUserDialog>;
Expand Down
6 changes: 5 additions & 1 deletion source/Gui/LoginDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "BrowserWindow.h"
#include "ResetPasswordDialog.h"
#include "ActivateUserDialog.h"
#include "StyleRepository.h"

_LoginDialog::_LoginDialog(
BrowserWindow const& browserWindow,
Expand Down Expand Up @@ -95,7 +96,7 @@ void _LoginDialog::process()
ImGui::SetItemDefaultFocus();

ImGui::SameLine();
ImGui::Dummy(ImVec2(40.0f, 0.0f));
AlienImGui::VerticalSeparator();

ImGui::SameLine();
ImGui::BeginDisabled(_userName.empty() || _password.empty());
Expand All @@ -115,6 +116,9 @@ void _LoginDialog::process()
}
ImGui::EndDisabled();

ImGui::SameLine();
AlienImGui::VerticalSeparator();

ImGui::SameLine();
if (AlienImGui::Button("Cancel")) {
ImGui::CloseCurrentPopup();
Expand Down
1 change: 1 addition & 0 deletions source/Gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ _MainWindow::_MainWindow(SimulationController const& simController, SimpleLogger

//cyclic references
_browserWindow->registerCyclicReferences(_loginDialog, _uploadSimulationDialog);
_activateUserDialog->registerCyclicReferences(_createUserDialog);

ifd::FileDialog::Instance().CreateTexture = [](uint8_t* data, int w, int h, char fmt) -> void* {
GLuint tex;
Expand Down
1 change: 0 additions & 1 deletion source/Gui/SimulationParametersWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,6 @@ void _SimulationParametersWindow::processSpot(
AlienImGui::SliderFloat(
AlienImGui::SliderFloatParameters()
.name("Absorption factor")
.tooltip("")
.textWidth(RightColumnWidth)
.logarithmic(true)
.colorDependence(true)
Expand Down

0 comments on commit 17217be

Please sign in to comment.