1 /*===========================================================================
2 *
3 *                            PUBLIC DOMAIN NOTICE
4 *               National Center for Biotechnology Information
5 *
6 *  This software/database is a "United States Government Work" under the
7 *  terms of the United States Copyright Act.  It was written as part of
8 *  the author's official duties as a United States Government employee and
9 *  thus cannot be copyrighted.  This software/database is freely available
10 *  to the public for use. The National Library of Medicine and the U.S.
11 *  Government have not placed any restriction on its use or reproduction.
12 *
13 *  Although all reasonable efforts have been taken to ensure the accuracy
14 *  and reliability of the software and data, the NLM and the U.S.
15 *  Government do not and cannot warrant the performance or results that
16 *  may be obtained by using this software or data. The NLM and the U.S.
17 *  Government disclaim all warranties, express or implied, including
18 *  warranties of performance, merchantability or fitness for any particular
19 *  purpose.
20 *
21 *  Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 */
26 
27 #ifndef SRACONFIG_H
28 #define SRACONFIG_H
29 
30 #include <QWidget>
31 
32 QT_BEGIN_NAMESPACE
33 class QHBoxLayout;
34 class QVBoxLayout;
35 class QButtonGroup;
36 class QCheckBox;
37 class QFrame;
38 class QLabel;
39 class QLineEdit;
40 class QPushButton;
41 QT_END_NAMESPACE
42 
43 class SRAConfigModel;
44 class vdbconf_model;
45 struct KNgcObj;
46 struct WorkspaceItem;
47 
48 class SRAConfigView : public QWidget
49 {
50     Q_OBJECT
51 
52 public:
53 
54     SRAConfigView ( QWidget *parent = 0 );
55     ~SRAConfigView ();
56 
57 signals:
58 
59     void dirty_config ();
60 
61 private slots:
62 
63    // void advanced_settings ();
64     void commit_config ();
65     void reload_config ();
66     void default_config ();
67     void modified_config ();
68 
69 
70     //void import_workspace ();
71 
72     //void edit_import_path ();
73     void edit_proxy_path ();
74     //void edit_public_path ();
75     //void edit_workspace_path ();
76 
77     void toggle_remote_enabled ( int toggled );
78     void toggle_local_caching ( int toggled );
79     void toggle_use_site ( int toggled );
80     void toggle_use_proxy ( int toggled );
81     void toggle_allow_all_certs ( int toggled );
82 
83 private:
84 
85     void closeEvent ( QCloseEvent *event );
86     void load_settings ();
87 
88     void add_workspace ( QString name, QString val, int ngc_id, bool insert = false );
89 
90     SRAConfigModel *model;
91 
92     QAction *discard_action;
93     QAction *apply_action;
94 
95     QVBoxLayout *main_layout;
96     QVBoxLayout *scrollWidgetLayout;
97     QVBoxLayout *workspace_layout;
98 
99     QButtonGroup *bg_remote_access;
100     QButtonGroup *bg_local_caching;
101     QButtonGroup *bg_use_site;
102     QButtonGroup *bg_use_proxy;
103     QButtonGroup *bg_allow_all_certs;
104 
105     QLineEdit *proxyEditor;
106 
107     QString *proxy_string;
108     QLabel *import_path_label;
109 
110     QFrame *adv_setting_window;
111 
112     QPushButton *apply_btn;
113     QPushButton *discard_btn;
114 
115     QWidget* setup_workflow_group ();
116     QWidget* setup_option_group ();
117     void setup_general_settings ();
118     void setup_network_setting ();
119 
120     WorkspaceItem *public_workspace;
121     QVector <WorkspaceItem *> protected_workspaces;
122 
123 };
124 
125 #endif // SRACONFIG_H
126