Skip to content

Commit

Permalink
Fixup export spec file button a little on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohns committed Aug 22, 2023
1 parent 53751de commit 0e4f16e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
9 changes: 9 additions & 0 deletions InterSpec/ExportSpecFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ namespace Wt
class WMenu;
class WCheckBox;
class WLineEdit;

#if( BUILD_AS_OSX_APP || IOS )
class WAnchor;
#endif
}//namespace Wt

namespace SpecUtils
Expand Down Expand Up @@ -225,7 +229,12 @@ class ExportSpecFileTool : public Wt::WContainerWidget

Wt::WText *m_msg;

#if( BUILD_AS_OSX_APP || IOS )
Wt::WAnchor *m_export_btn;
#else
Wt::WPushButton *m_export_btn;
#endif

#if( USE_QR_CODES )
Wt::WPushButton *m_show_qr_btn;
#endif
Expand Down
7 changes: 7 additions & 0 deletions InterSpec_resources/ExportSpecFile.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,10 @@
text-overflow: ellipsis;
margin-left: 10px;
}


.ExportSpecFileTool .LinkBtn.ExportSpecExportBtn
{
float: none;
border: 1px solid blue !important;
}
27 changes: 21 additions & 6 deletions src/ExportSpecFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ void ExportSpecFileTool::init()


WPushButton *cancel_btn = new WPushButton( "Cancel", btnsDiv );
cancel_btn->addStyleClass( "LightButton" );
cancel_btn->clicked().connect( boost::bind(&ExportSpecFileTool::emitDone, this, false) );

if( !m_resource )
Expand All @@ -948,16 +949,30 @@ void ExportSpecFileTool::init()
m_resource->downloadFinished().connect( boost::bind(&ExportSpecFileTool::emitDone, this, true) );
}//if( !m_resource )

m_export_btn = new WPushButton( "Export", btnsDiv );

#if( BUILD_AS_OSX_APP || IOS )
m_export_btn = new WAnchor( WLink(m_resource), btnsDiv );
m_export_btn->setTarget( AnchorTarget::TargetNewWindow );
m_export_btn->setStyleClass( "DownloadLink ExportSpecExportBtn" );
#else
m_export_btn = new WPushButton( btnsDiv );
m_export_btn->setLink( WLink(m_resource) );
m_export_btn->setLinkTarget( AnchorTarget::TargetNewWindow );
m_export_btn->disable();

m_export_btn->setStyleClass( "LinkBtn DownloadBtn ExportSpecExportBtn" );
#if( ANDROID )
// Using hacked saving to temporary file in Android, instead of via network download of file.
TODO: have the click call a member function that calls the ansdroid download workaraound with the proper filename.
m_export_btn->clicked().connect( std::bind( [this](){ android_download_workaround( m_resource, "spectrum_file" ); } ) );
// Using hacked saving to temporary file in Android, instead of via network download of file.
m_export_btn->clicked().connect( std::bind( [this](){
string filename = m_resource->suggestedFileName().toUTF8();
if( filename.empty() )
filename = "spectrum_file";
android_download_workaround( m_resource, filename );
} ) );
#endif //ANDROID
#endif

m_export_btn->setText( "Export" );
m_export_btn->disable();


#if( USE_QR_CODES )
Expand Down

0 comments on commit 0e4f16e

Please sign in to comment.