Skip to content
Snippets Groups Projects
Commit c4edc5a9 authored by stefan's avatar stefan
Browse files

RemoteLoader, added remote site name to "Load" button

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2437 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 51381ec9
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,8 @@ RemoteLoader::RemoteLoader(QWidget* parent): ...@@ -73,6 +73,8 @@ RemoteLoader::RemoteLoader(QWidget* parent):
action_list_.append(select_url_action); action_list_.append(select_url_action);
connect(select_url_action, SIGNAL(triggered(bool)), this, SLOT(UrlClick())); connect(select_url_action, SIGNAL(triggered(bool)), this, SLOT(UrlClick()));
this->BuildMenu();
this->RenameButton();
} }
void RemoteLoader::UrlClick() void RemoteLoader::UrlClick()
...@@ -83,7 +85,7 @@ void RemoteLoader::UrlClick() ...@@ -83,7 +85,7 @@ void RemoteLoader::UrlClick()
void RemoteLoader::BuildMenu(String active_loader) void RemoteLoader::BuildMenu(String active_loader)
{ {
if(active_loader.size()>0){ if(!active_loader.empty()){
selected_site_loader_ = active_loader; selected_site_loader_ = active_loader;
} }
else if(site_actions_->checkedAction()!=NULL){ else if(site_actions_->checkedAction()!=NULL){
...@@ -100,6 +102,7 @@ void RemoteLoader::BuildMenu(String active_loader) ...@@ -100,6 +102,7 @@ void RemoteLoader::BuildMenu(String active_loader)
RemoteSiteLoader* loader = FileLoader::GetLoaderManager()->GetRemoteSiteLoader(loader_ident); RemoteSiteLoader* loader = FileLoader::GetLoaderManager()->GetRemoteSiteLoader(loader_ident);
if(loader && ((loader->IsImg() && img_support_) || !loader->IsImg())){ if(loader && ((loader->IsImg() && img_support_) || !loader->IsImg())){
QAction* action = new QAction(loader_ident,site_loader_menu_); QAction* action = new QAction(loader_ident,site_loader_menu_);
connect(action, SIGNAL(triggered()), this, SLOT(RenameButton()));
action->setCheckable(true); action->setCheckable(true);
site_actions_->addAction(action); site_actions_->addAction(action);
if((site_actions_->checkedAction()==NULL && loader_ident == FileLoader::GetLoaderManager()->GetDefaultRemoteSiteIdent()) ||selected_site_loader_==loader_ident.toStdString() ){ if((site_actions_->checkedAction()==NULL && loader_ident == FileLoader::GetLoaderManager()->GetDefaultRemoteSiteIdent()) ||selected_site_loader_==loader_ident.toStdString() ){
...@@ -132,6 +135,10 @@ bool RemoteLoader::Restore(const QString& prefix) ...@@ -132,6 +135,10 @@ bool RemoteLoader::Restore(const QString& prefix)
if (settings.contains("loader")) { if (settings.contains("loader")) {
this->BuildMenu(settings.value("loader").toString().toStdString()); this->BuildMenu(settings.value("loader").toString().toStdString());
} }
else{
this->BuildMenu();
}
this->RenameButton();
return true; return true;
} }
...@@ -187,6 +194,14 @@ void RemoteLoader::DownloadFinished(){ ...@@ -187,6 +194,14 @@ void RemoteLoader::DownloadFinished(){
this->ShowProgressBar(false); this->ShowProgressBar(false);
} }
void RemoteLoader::RenameButton(){
if(site_actions_->checkedAction()){
QString text = "Load (" + site_actions_->checkedAction()->text() + ")";
button_->setText(text);
}
}
OST_REGISTER_WIDGET_WITH_DEFAULT_FACTORY(ost::gui, RemoteLoader, "Remote Loader"); OST_REGISTER_WIDGET_WITH_DEFAULT_FACTORY(ost::gui, RemoteLoader, "Remote Loader");
}} }}
......
...@@ -53,6 +53,7 @@ private slots: ...@@ -53,6 +53,7 @@ private slots:
void UrlClick(); void UrlClick();
void DownloadFinished(); void DownloadFinished();
void UpdateProgress(qint64 read, qint64 total); void UpdateProgress(qint64 read, qint64 total);
void RenameButton();
private: private:
QLineEdit* line_edit_; QLineEdit* line_edit_;
......
...@@ -49,8 +49,8 @@ def _InitFrontEnd(): ...@@ -49,8 +49,8 @@ def _InitFrontEnd():
app=gui.GostyApp.Instance() app=gui.GostyApp.Instance()
app.SetAppTitle("DNG") app.SetAppTitle("DNG")
main_area=app.perspective.main_area main_area=app.perspective.main_area
_InitPanels(app)
_InitMenuBar(app) _InitMenuBar(app)
_InitPanels(app)
_InitSpaceNav(app) _InitSpaceNav(app)
_InitContextMenu(app) _InitContextMenu(app)
main_area.AddPersistentWidget("3D Scene", "gl_win" , app.gl_win, int(QtCore.Qt.WindowMaximized)) main_area.AddPersistentWidget("3D Scene", "gl_win" , app.gl_win, int(QtCore.Qt.WindowMaximized))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment