Skip to content

Commit

Permalink
Re #6798 Workspace tree updated from ConfigDialog on apply
Browse files Browse the repository at this point in the history
  • Loading branch information
PranavBahuguna committed Jul 21, 2016
1 parent 13db2a6 commit 803cc0b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 deletions.
60 changes: 60 additions & 0 deletions Framework/Kernel/inc/MantidKernel/GitHubApiHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#ifndef MANTID_KERNEL_GitHubApiHelper_H_
#define MANTID_KERNEL_GitHubApiHelper_H_

#include "MantidKernel/InternetHelper.h"

namespace Mantid {
namespace Kernel {

/** GitHubApiHelper : A helper class for supporting access to the github api
through HTTP and HTTPS, inherits from the InternetHelper.
This class automatically adds the authorization to a read only account.
Copyright © 2016 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTID_KERNEL_DLL GitHubApiHelper : public InternetHelper {
public:
GitHubApiHelper();
GitHubApiHelper(const Kernel::ProxyInfo &proxy);
virtual ~GitHubApiHelper() = default;

void reset() override;
bool isAuthenticated();

protected:
virtual void processResponseHeaders(const Poco::Net::HTTPResponse &res) override;
virtual int sendRequestAndProcess(Poco::Net::HTTPClientSession &session,
Poco::URI &uri, std::ostream &responseStream) override;
private:
int processAnonymousRequest(const Poco::Net::HTTPResponse &response,
Poco::URI &uri,
std::ostream &responseStream);
void addAuthenticationToken() {
addHeader("Authorization",
"token 8ec7afc857540ee60af78cba1cf7779a6ed0b6b9");
}
};

} // namespace Kernel
} // namespace Mantid

#endif /* MANTID_KERNEL_GitHubApiHelper_H_ */
15 changes: 13 additions & 2 deletions MantidPlot/src/ConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2657,8 +2657,19 @@ void ConfigDialog::updateMantidOptionsTab() {

// invisible workspaces options
QString showinvisible_ws = m_invisibleWorkspaces->isChecked() ? "1" : "0";
cfgSvc.setString("MantidOptions.InvisibleWorkspaces",
showinvisible_ws.toStdString());

// store it if it has changed
if (showinvisible_ws.toStdString() !=
cfgSvc.getString("MantidOptions.InvisibleWorkspaces")) {
cfgSvc.setString("MantidOptions.InvisibleWorkspaces",
showinvisible_ws.toStdString());

// update the workspace tree
if (ApplicationWindow *app =
dynamic_cast<ApplicationWindow *>(this->parentWidget())) {
app->mantidUI->updateWorkspaces();
}
}

// OpenGL option
QString setting = m_useOpenGL->isChecked() ? "On" : "Off";
Expand Down
3 changes: 3 additions & 0 deletions MantidPlot/src/Mantid/MantidUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ void MantidUI::x_range_from_picker(double xmin, double xmax) {
/// Updates the algorithms tree as this may have changed
void MantidUI::updateAlgorithms() { m_exploreAlgorithms->update(); }

/// Updates the workspace tree
void MantidUI::updateWorkspaces() { m_exploreMantid->updateTree(); }

/// Show / hide the AlgorithmDockWidget
void MantidUI::showAlgWidget(bool on) {
if (on) {
Expand Down
2 changes: 2 additions & 0 deletions MantidPlot/src/Mantid/MantidUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ class MantidUI : public QObject {
AlgorithmMonitor *getAlgMonitor() { return m_algMonitor; }
/// updates the algorithms tree
void updateAlgorithms();
/// updates the workspaces tree
void updateWorkspaces();
/// Show the algorithm dock widget
void showAlgWidget(bool on = true);

Expand Down

0 comments on commit 803cc0b

Please sign in to comment.