ctkXnatLoginDialog.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) University College London,
  4. Centre for Medical Image Computing
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef ctkXnatLoginDialog_h
  16. #define ctkXnatLoginDialog_h
  17. #include <QDialog>
  18. #include "ctkXNATWidgetsExport.h"
  19. #include "ui_ctkXnatLoginDialog.h"
  20. #include "ctkXnatLoginProfile.h"
  21. class ctkXnatConnection;
  22. class ctkXnatConnectionFactory;
  23. class ctkXnatLoginDialogPrivate;
  24. class ctkXnatSettings;
  25. class CTK_XNAT_WIDGETS_EXPORT ctkXnatLoginDialog : public QDialog
  26. {
  27. Q_OBJECT
  28. public:
  29. explicit ctkXnatLoginDialog(ctkXnatConnectionFactory* f, QWidget* parent = 0, Qt::WindowFlags flags = 0);
  30. virtual ~ctkXnatLoginDialog();
  31. ctkXnatSettings* settings() const;
  32. void setSettings(ctkXnatSettings* settings);
  33. ctkXnatConnection* getConnection();
  34. virtual void accept();
  35. private slots:
  36. void on_btnSave_clicked();
  37. void on_btnDelete_clicked();
  38. void on_edtProfileName_textChanged(const QString& text);
  39. void onFieldChanged();
  40. void onCurrentProfileChanged(const QModelIndex& current);
  41. void resetLstProfilesCurrentIndex();
  42. private:
  43. void createConnections();
  44. void blockSignalsOfFields(bool value);
  45. void saveProfile(const QString& profileName);
  46. bool askToSaveProfile(const QString& profileName);
  47. void loadProfile(const ctkXnatLoginProfile& profile = ctkXnatLoginProfile());
  48. void storeProfile(ctkXnatLoginProfile& profile);
  49. /// \brief All the controls for the main view part.
  50. Ui::ctkXnatLoginDialog* ui;
  51. /// \brief d pointer of the pimpl pattern
  52. QScopedPointer<ctkXnatLoginDialogPrivate> d_ptr;
  53. Q_DECLARE_PRIVATE(ctkXnatLoginDialog);
  54. Q_DISABLE_COPY(ctkXnatLoginDialog);
  55. };
  56. #endif