Skip to content

Commit

Permalink
Fix up file export layout for mobile, a little.
Browse files Browse the repository at this point in the history
A few other small changes.
  • Loading branch information
wcjohns committed Oct 2, 2024
1 parent 9c8cd7c commit 788c1a8
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 33 deletions.
46 changes: 34 additions & 12 deletions InterSpec_resources/ExportSpecFile.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,17 @@
{
flex-grow: 2;
margin-top: 5px;
height: 330px;
}

.ExportSpecFileTool .ExportSpecFileBody .ExportColTitle
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFileTabs > .Wt-stack
{
height: 300px;
display: flex;
flex-direction: column;
}

.ExportSpecFileTool .ExportColTitle
{
display: block;
white-space: nowrap;
Expand All @@ -92,6 +100,24 @@
row-gap: 5px;
}

.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecSelect,
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFormat,
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecSamples,
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecOptions
{
border: none;

margin-left: auto;
margin-right: auto;
margin-top: 10px;
}

.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecSelect,
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFormat,
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecSamples
{
overflow-y: auto;
}

.ExportSpecFileTool .ExportSpecSamples
{
Expand All @@ -110,7 +136,7 @@
margin-right: 5px;
}

.ExportSpecFileTool .ExportSpecFileBody .ExportSpecSelect .ExportSpecInfo
.ExportSpecFileTool .ExportSpecSelect .ExportSpecInfo
{
display: inline-block;
overflow-y: auto;
Expand All @@ -133,9 +159,7 @@

.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecSelect
{
margin-left: auto;
margin-right: auto;
margin-top: 10px;

}

.ExportSpecInfo .ExportSpecInfoTable
Expand Down Expand Up @@ -175,13 +199,6 @@
height: 100%;
}

.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFormat
{
height: 300px;
overflow-y: auto;
}


.ExportSpecFileTool .ExportSpecFormat .ExportSpecFormatMenu.SideMenu
{
overflow-y: auto;
Expand Down Expand Up @@ -230,6 +247,11 @@
border-bottom: none;
}

.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecOptions
{
width: 100%;
}

.ExportSpecFileTool .ExportSpecFileBody .ExportSpecOptions .ExportColTitle
{
}
Expand Down
Binary file added InterSpec_resources/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion data/config/wt_config_localweb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
by setting this property, or for an individual application
entry point by passing a location to WServer::addEntryPoint().
-->
<!-- <property name="favicon">images/favicon.ico</property> -->
<property name="favicon">InterSpec_resources/favicon.ico</property>
</properties>

</application-settings>
Expand Down
13 changes: 8 additions & 5 deletions src/ExportSpecFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ const std::vector<std::pair<SpecUtils::SaveSpectrumAsType,std::string>> sm_file_
#if( USE_QR_CODES )
namespace
{
const int ns_min_screen_width_for_wide_layout = 750;

std::string clean_uuid( string uuid )
{
SpecUtils::trim(uuid);
Expand Down Expand Up @@ -741,18 +743,19 @@ void ExportSpecFileTool::init()
const bool showToolTips = InterSpecUser::preferenceValue<bool>( "ShowTooltips", m_interspec );
const bool isMobile = m_interspec && m_interspec->isMobile();

const int screenWidth = m_interspec->renderedWidth();
const bool isPhone = (screenWidth > 100) ? (screenWidth < 640) : m_interspec->isPhone();

if( isMobile )
addStyleClass( "ExportSpecFileToolMobile" );

const int screenWidth = m_interspec->renderedWidth();
const bool isPhone = (screenWidth > 100) ? (screenWidth < ns_min_screen_width_for_wide_layout) : m_interspec->isPhone();

WTabWidget *mobileTabs = nullptr;
WContainerWidget *body = nullptr;

if( isPhone )
{
addStyleClass( "ExportSpecFileToolPhone" );

mobileTabs = new WTabWidget( this );
mobileTabs->addStyleClass( "ExportSpecFileTabs" );
}else
Expand Down Expand Up @@ -3619,15 +3622,15 @@ ExportSpecFileWindow::ExportSpecFileWindow( InterSpec *viewer )
addStyleClass( "export-spec-file" );

const int w = viewer->renderedWidth();
const bool isPhone = (w > 100) ? (w < 640) : (viewer && viewer->isPhone());
const bool isPhone = (w > 100) ? (w < ns_min_screen_width_for_wide_layout) : (viewer && viewer->isPhone());

if( isPhone )
{
resize( 320, Wt::WLength::Auto ); //320 px is about the smallest width Android phone to expect
}else
{
//setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 800.0) : 800.0 ,WLength::Pixel), WLength::Auto );
setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 600.0) : 600.0 ,WLength::Pixel), WLength::Auto );
setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 650.0) : 650.0, WLength::Pixel), WLength::Auto );
}
m_tool = new ExportSpecFileTool( viewer, contents() );
m_tool->done().connect( boost::bind(&ExportSpecFileWindow::accept, this) );
Expand Down
48 changes: 34 additions & 14 deletions src/InterSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11039,24 +11039,44 @@ void InterSpec::setSpectrum( std::shared_ptr<SpecMeas> meas,

if( (spec_type == SpecUtils::SpectrumType::Foreground) && previous && (previous != meas) )
{
closeShieldingSourceFit();
saveShieldingSourceModelToForegroundSpecMeas();
#if( USE_REL_ACT_TOOL )
saveRelActManualStateToForegroundSpecMeas();
saveRelActAutoStateToForegroundSpecMeas();
#endif

#if( USE_DB_TO_STORE_SPECTRA )
//if( m_user->preferenceValue<bool>( "AutoSaveSpectraToDb" ) )
//{
// //We also need to do this in the InterSpec destructor as well.
// // Also maybe change size limitations to only apply to auto saving
// if( current_state_index >= 0 )
// {
// //Save to (HEAD) of current state
// }else
// {
// //Create a state
// //Handle case where file is to large to be saved
// }
//}
/*
if( previous && m_user->preferenceValue<bool>( "AutoSaveSpectraToDb" ) )
{
//We also need to do this in the InterSpec destructor as well.
// Also maybe change size limitations to only apply to auto saving
const long long int current_state_index = currentAppStateDbId();
if( current_state_index >= 0 )
{
startStoreStateInDb( false, false, false, false ); //save snapshot
}else
{
m_fileManager->saveToDatabase( previous );
}
}//if(
*/
#endif //#if( USE_DB_TO_STORE_SPECTRA )

// Close Shielding/Source fit Window
if( m_shieldingSourceFitWindow )
{
delete m_shieldingSourceFitWindow;
m_shieldingSourceFitWindow = nullptr;
m_shieldingSourceFit = nullptr;
}


if( m_relActAutoGui )
{
// TODO: Should we close this?
}

if( m_riidDisplay )
programmaticallyCloseRiidResults();
}//if( (spec_type == SpecUtils::SpectrumType::Foreground) && !!previous && (previous != meas) )
Expand Down
2 changes: 1 addition & 1 deletion src/SpectraFileModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ std::shared_ptr<SpecMeas> SpectraFileHeader::resetFromDatabase(
std::shared_ptr<SpecMeas> memobj = dbdata->decodeSpectrum();
setMeasurmentInfo( memobj );

m_displayName = info->filename;
m_displayName = SpecUtils::filename( info->filename );
m_uploadTime = info->uploadTime;
m_modifiedSinceDecode = info->userHasModified;

Expand Down

0 comments on commit 788c1a8

Please sign in to comment.