70 inline static std::string_view logger_name =
"ores.qt.add_item_dialog";
72 [[nodiscard]]
static auto& lg() {
74 static auto instance = make_logger(logger_name);
81 QWidget* parent =
nullptr);
85 ItemType itemType()
const {
return itemType_; }
87 void setCreateMode(
bool createMode);
88 bool isCreateMode()
const {
return isCreateMode_; }
93 void setInitialParent(
const std::optional<boost::uuids::uuid>& parentId);
102 void setInitialFolder(
const std::optional<boost::uuids::uuid>& folderId);
103 std::optional<std::string> getPassword()
const;
106 void setTags(
const std::vector<connections::domain::tag>& tags);
107 std::vector<boost::uuids::uuid> getSelectedTagIds()
const;
112 QString itemName()
const;
115 void statusMessage(
const QString& message);
116 void errorMessage(
const QString& message);
117 void folderSaved(
const boost::uuids::uuid&
id,
const QString& name);
118 void environmentSaved(
const boost::uuids::uuid&
id,
const QString& name);
119 void connectionSaved(
const boost::uuids::uuid&
id,
const QString& name);
122 void onSaveClicked();
123 void onCancelClicked();
124 void onTestClicked();
125 void onTypeChanged(
int index);
126 void onPasswordChanged();
127 void onEnvironmentComboChanged(
int index);
128 void togglePasswordVisibility();
129 void updateSaveButtonState();
133 QWidget* setupButtons();
134 void populateFolderCombo();
135 void populateEnvironmentCombo();
136 void updateFieldVisibility();
137 bool validateInput();
139 void saveEnvironment();
140 void saveConnection();
145 QPushButton* saveButton_;
146 QPushButton* cancelButton_;
147 QPushButton* testButton_;
150 QComboBox* typeCombo_;
153 QLineEdit* nameEdit_;
154 QComboBox* folderCombo_;
155 QTextEdit* descriptionEdit_;
158 QLabel* environmentLabel_;
159 QComboBox* environmentCombo_;
163 QLineEdit* hostEdit_;
165 QSpinBox* portSpinBox_;
166 QLabel* httpPortLabel_;
167 QSpinBox* httpPortSpinBox_;
168 QLabel* namespaceLabel_;
169 QLineEdit* namespaceEdit_;
172 QLabel* usernameLabel_;
173 QLineEdit* usernameEdit_;
174 QLabel* passwordLabel_;
175 QLineEdit* passwordEdit_;
176 QCheckBox* showPasswordCheckbox_;
177 QWidget* passwordWidget_;
184 ItemType itemType_{ItemType::Connection};
185 bool isCreateMode_{
true};
186 bool passwordChanged_{
false};
189 boost::uuids::uuid folderId_;
190 boost::uuids::uuid pureEnvironmentId_;
191 boost::uuids::uuid connectionId_;
194 std::optional<boost::uuids::uuid> linkedEnvironmentId_;
std::function< QString(const QString &host, int port, const QString &username, const QString &password)> TestConnectionCallback
Callback type for testing connections.
Definition ConnectionTypes.hpp:36
Combined modeless dialog for creating and editing folders, environments, and connections.
Definition AddItemDialog.hpp:66