Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
boshkins committed Feb 27, 2018
2 parents 32b1702 + 0679150 commit c7ef978
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 101 deletions.
137 changes: 58 additions & 79 deletions tools/sra-toolkit/config/sraconfigview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,6 @@ SRAConfigView :: SRAConfigView ( QWidget *parent )

main_layout -> addWidget ( setup_workflow_group () );
main_layout -> addWidget ( setup_option_group () );
//main_layout -> addWidget ( setup_workspace_group () );
//main_layout -> addLayout ( setup_button_layout () );

setLayout ( main_layout );

Expand Down Expand Up @@ -591,6 +589,33 @@ void SRAConfigView :: init ()
bg_prioritize_http -> button ( 1 ) -> setChecked ( true );
}

QWidget * SRAConfigView::setup_workflow_group ()
{
QWidget *widget = new QWidget ();
widget -> setObjectName ( "workflow_widget" );
widget -> setFixedHeight ( 70 );
widget -> setFixedWidth ( size () . width () );

QHBoxLayout *layout = new QHBoxLayout ();
layout -> setAlignment ( Qt::AlignBottom | Qt::AlignRight );
layout -> setSpacing ( 5 );

apply_btn = new QPushButton ( "Apply" );
apply_btn -> setDisabled ( true );
connect ( apply_btn, SIGNAL ( clicked () ), this, SLOT ( commit_config () ) );

discard_btn = new QPushButton ( "Revert" );
discard_btn -> setDisabled ( true );
connect ( discard_btn, SIGNAL ( clicked () ), this, SLOT ( reload_config () ) );

layout -> addWidget ( discard_btn );
layout -> addWidget ( apply_btn );

widget -> setLayout ( layout );

return widget;
}

static
QButtonGroup * make_no_yes_button_group ( QPushButton **p_no, QPushButton **p_yes )
{
Expand All @@ -615,18 +640,6 @@ QButtonGroup * make_no_yes_button_group ( QPushButton **p_no, QPushButton **p_ye
return group;
}

QWidget * SRAConfigView::setup_workflow_group ()
{
QWidget *widget = new QWidget ();
widget -> setObjectName ( "workflow_widget" );
widget -> setFixedHeight ( 70 );
widget -> setFixedWidth ( size () . width () );

QHBoxLayout *layout = new QHBoxLayout ();

return widget;
}

static
QWidget * make_button_option_row ( QString name, QString desc,
QPushButton *b1, QPushButton *b2 )
Expand Down Expand Up @@ -881,42 +894,6 @@ QGroupBox * SRAConfigView :: setup_workspace_group ()
return group;
}
*/
QVBoxLayout * SRAConfigView::setup_button_layout ()
{
QVBoxLayout *v_layout = new QVBoxLayout ();

// 1
QHBoxLayout *layout = new QHBoxLayout ();
layout -> setAlignment ( Qt::AlignTop | Qt::AlignRight );

QPushButton *advanced = new QPushButton ( "Advanced" );
advanced -> setFixedWidth ( 150 );
connect ( advanced, SIGNAL ( clicked () ), this, SLOT ( advanced_settings () ) );

layout -> addWidget ( advanced );
v_layout -> addLayout ( layout );
v_layout -> addStretch ( 1 );

// 2
layout = new QHBoxLayout ();
layout -> setAlignment ( Qt::AlignBottom | Qt::AlignRight );
layout -> setSpacing ( 5 );

apply_btn = new QPushButton ( "Apply" );
apply_btn -> setDisabled ( true );
connect ( apply_btn, SIGNAL ( clicked () ), this, SLOT ( commit_config () ) );

discard_btn = new QPushButton ( "Revert" );
discard_btn -> setDisabled ( true );
connect ( discard_btn, SIGNAL ( clicked () ), this, SLOT ( reload_config () ) );

layout -> addWidget ( discard_btn );
layout -> addWidget ( apply_btn );

v_layout -> addLayout ( layout );

return v_layout;
}

void SRAConfigView :: closeEvent ( QCloseEvent *ev )
{
Expand Down Expand Up @@ -991,14 +968,12 @@ void SRAConfigView :: commit_config ()
void SRAConfigView :: reload_config ()
{
model -> reload ();
//populate ();
init ();

if ( ! model -> config_changed () )
{
apply_btn -> setDisabled ( true );
//apply_action -> setDisabled ( true );
discard_btn -> setDisabled ( true );
//discard_action -> setDisabled ( true );
}
}

Expand All @@ -1007,69 +982,67 @@ void SRAConfigView :: modified_config ()
if ( model -> config_changed () ) // this wont trigger on workspace addition yet
{
apply_btn -> setDisabled ( false );
//apply_action -> setDisabled ( false );
discard_btn -> setDisabled ( false );
//discard_action -> setDisabled ( false );
}
}

// TBD - still needs a menu item to be triggered. -- this is not a hard reset - it still keeps some user settings
void SRAConfigView :: default_config ()
{
model -> set_remote_enabled ( true );
model -> set_global_cache_enabled ( true );
model -> set_site_enabled ( true );

//populate ();

emit dirty_config ();
}
init ();

void SRAConfigView :: toggle_remote_enabled ( bool toggled )
{
model -> set_remote_enabled ( toggled );
emit dirty_config ();
}

void SRAConfigView :: toggle_remote_enabled ( int toggled )
{
if ( toggled == 1 )
{
qDebug () << "remote_enabled: yes";
model -> set_remote_enabled ( true );
}
else
{
qDebug () << "remote_enabled: no";
}
model -> set_remote_enabled ( false );
}

void SRAConfigView :: toggle_local_caching ( bool toggled )
{
model -> set_global_cache_enabled ( toggled );
emit dirty_config ();
}

void SRAConfigView :: toggle_local_caching ( int toggled )
{
if ( toggled == 1 )
{
qDebug () << "local_caching: yes";
model -> set_global_cache_enabled ( true );
}
else
{
qDebug () << "local_caching: no";
}
model -> set_global_cache_enabled ( false );
}

void SRAConfigView :: toggle_use_site ( bool toggled )
{
model -> set_site_enabled ( toggled );
emit dirty_config ();
}

void SRAConfigView :: toggle_use_site ( int toggled )
{
if ( toggled == 1 )
{
qDebug () << "use_site: yes";
model -> set_site_enabled ( true );

}
else
{
qDebug () << "use_site: no";
}
model -> set_site_enabled ( false );
}

void SRAConfigView :: toggle_use_proxy ( bool toggled )
{
model -> set_proxy_enabled ( toggled );
emit dirty_config ();
}

Expand All @@ -1078,27 +1051,33 @@ void SRAConfigView :: toggle_use_proxy ( int toggled )
if ( toggled == 1 )
{
qDebug () << "use_proxy: yes";
model -> set_proxy_enabled ( true );
proxyEditor -> setDisabled ( false );
}
else
{
qDebug () << "use_proxy: no";
model -> set_proxy_enabled ( false );
proxyEditor -> setDisabled ( true );
}
}

void SRAConfigView :: toggle_prioritize_http ( bool toggled )
{
model -> set_proxy_priority ( toggled );
emit dirty_config ();
}

void SRAConfigView :: toggle_prioritize_http ( int toggled )
{
if ( toggled == 1 )
{
qDebug () << "prioritize_http: yes";
model -> set_proxy_priority ( true );
}
else
{
qDebug () << "prioritize_http: no";
model -> set_proxy_priority ( false );
}

emit dirty_config ();
}

void SRAConfigView :: edit_import_path ()
Expand Down
8 changes: 0 additions & 8 deletions tools/sra-toolkit/config/sraconfigview.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ private slots:
void edit_public_path ();
void edit_workspace_path ();

void toggle_remote_enabled ( bool toggled );
void toggle_local_caching ( bool toggled );
void toggle_use_site ( bool toggled );
void toggle_use_proxy ( bool toggled );
void toggle_prioritize_http ( bool toggled );

void toggle_remote_enabled ( int toggled );
void toggle_local_caching ( int toggled );
void toggle_use_site ( int toggled );
Expand Down Expand Up @@ -120,8 +114,6 @@ private slots:

QWidget* setup_workflow_group ();
QWidget* setup_option_group ();
//QGroupBox* setup_workspace_group ();
QVBoxLayout *setup_button_layout();

WorkspaceItem *public_workspace;
QVector <WorkspaceItem *> protected_workspaces;
Expand Down
19 changes: 19 additions & 0 deletions tools/sra-toolkit/qss/official_style.qss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#spacer_line
{
color: rgba(153,153,204,1.0) ;
}

/*******************************************************************************
* Tool Bar
Expand All @@ -17,6 +21,21 @@
background: rgba(0,0,0,0.9);
}

/*
#tool_bar_button[type="home"]::hover
{
background: rgba(153,153,204,0.2);
border: 1px;
}

#tool_bar_button[type="home"]::checked
{
background: rgba(153,153,204,0.2);
border: 1px;
}
*/


/*******************************************************************************
* SRAToolView
*******************************************************************************/
Expand Down
47 changes: 37 additions & 10 deletions tools/sra-toolkit/sratoolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void SRAToolBar::init ()

home_button = new QPushButton ();
home_button -> setObjectName ( "tool_bar_button" );
home_button -> setProperty ( "type", "home" );
home_button -> setFixedHeight ( 70 );
home_button -> setCheckable ( true );
home_button -> setChecked ( true );
Expand All @@ -49,10 +50,23 @@ void SRAToolBar::init ()
expand_button = new QPushButton ();
connect ( expand_button, SIGNAL ( clicked () ), this, SLOT ( expand () ) );
expand_button -> setObjectName ( "tool_bar_button" );
expand_button -> setProperty ( "type", "expand" );
expand_button -> setFixedHeight ( 50 );

updateButtonIcons ();

QFrame *line = new QFrame ();
line -> setObjectName ( "spacer_line" );
line -> setFrameShape ( QFrame::HLine );
line -> setFixedHeight ( 2 );
line -> setMinimumWidth ( width () * .8 );

QFrame *line2= new QFrame ();
line2 -> setObjectName ( "spacer_line" );
line2 -> setFrameShape ( QFrame::HLine );
line2 -> setFixedHeight ( 2 );
line2 -> setMinimumWidth ( width () * .8 );

toolBar -> addButton ( home_button );
toolBar -> setId ( home_button, 0 );

Expand All @@ -64,11 +78,18 @@ void SRAToolBar::init ()

QVBoxLayout *layout = new QVBoxLayout ();
layout -> setMargin ( 0 );
layout -> setSpacing ( 12 );
layout -> setSpacing ( 0 );

layout -> addWidget ( home_button );
layout -> addSpacing ( 20 );
layout -> addWidget ( line );
layout -> addSpacing ( 20 );
layout -> addWidget ( config_button );
layout -> addSpacing ( 8 );
layout -> addWidget ( diagnostics_button );
layout -> addSpacing ( 20 );
layout -> addWidget ( line2 );

layout -> addWidget ( expand_button, 0, Qt::AlignBottom );

setLayout ( layout );
Expand All @@ -81,28 +102,34 @@ void SRAToolBar :: updateButtonIcons ()
home_button -> setIcon ( QIcon ( img_path + "ncbi_logo_long.svg") . pixmap ( QSize ( 176, 48 ) ) );
home_button -> setIconSize ( QSize ( 192, 70 ) );

config_button -> setIcon ( QIcon ( img_path + "ncbi_config_button_long.svg" ).pixmap ( QSize ( 176, 64 ) ) );
config_button -> setIcon ( QIcon ( img_path + "ncbi_config_button_long.svg" )
.pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_LONG, TOOLBAR_BUTTON_HEIGHT ) ) );
config_button -> setIconSize ( QSize ( TOOLBAR_BUTTON_WIDTH_LONG, TOOLBAR_BUTTON_HEIGHT ) );

diagnostics_button -> setIcon ( QIcon ( img_path + "ncbi_diagnostics_button_long.svg" ).pixmap ( QSize ( 176, 64 ) ) );
diagnostics_button -> setIcon ( QIcon ( img_path + "ncbi_diagnostics_button_long.svg" )
.pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_LONG, TOOLBAR_BUTTON_HEIGHT ) ) );
diagnostics_button -> setIconSize ( QSize ( TOOLBAR_BUTTON_WIDTH_LONG, TOOLBAR_BUTTON_HEIGHT ) );

expand_button -> setIcon ( QIcon ( img_path + "ncbi_expand_toolbar_button.svg" ).pixmap ( QSize ( 32, 32 ) ) );
expand_button -> setIconSize ( QSize ( 192, 70 ) );
expand_button -> setIconSize ( QSize ( 192, 50 ) );
}
else
{
home_button -> setIcon ( QIcon ( img_path + "ncbi_helix_vertical_white.svg") . pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_WIDTH_SHORT ) ) );
home_button -> setIconSize ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_WIDTH_SHORT ) );
home_button -> setIcon ( QIcon ( img_path + "ncbi_helix_vertical_white.svg")
. pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_HEIGHT ) ) );
home_button -> setIconSize ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_HEIGHT ) );

config_button -> setIcon ( QIcon ( img_path + "ncbi_config_button_white.svg" ).pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_WIDTH_SHORT ) ) );
config_button -> setIcon ( QIcon ( img_path + "ncbi_config_button_white.svg" )
.pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_HEIGHT ) ) );
config_button -> setIconSize ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_HEIGHT ) );

diagnostics_button -> setIcon ( QIcon ( img_path + "ncbi_diagnostics_button_white.svg" ).pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_WIDTH_SHORT ) ) );
diagnostics_button -> setIcon ( QIcon ( img_path + "ncbi_diagnostics_button_white.svg" )
.pixmap ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_HEIGHT ) ) );
diagnostics_button -> setIconSize ( QSize ( TOOLBAR_BUTTON_WIDTH_SHORT, TOOLBAR_BUTTON_HEIGHT ) );

expand_button -> setIcon ( QIcon ( img_path + "ncbi_expand_toolbar_button.svg" ).pixmap ( QSize ( 32, 32 ) ) );
expand_button -> setIconSize ( QSize ( 32, 32 ) );
expand_button -> setIcon ( QIcon ( img_path + "ncbi_expand_toolbar_button.svg" )
.pixmap ( QSize ( 32, 32 ) ) );
expand_button -> setIconSize ( QSize ( 32, 50 ) );
}
}

Expand Down
Loading

0 comments on commit c7ef978

Please sign in to comment.