Skip to content

Commit 9c8cd7c

Browse files
committed
Start converting file export dialog to work on phones in portrait mode.
1 parent d834788 commit 9c8cd7c

File tree

3 files changed

+63
-7
lines changed

3 files changed

+63
-7
lines changed

InterSpec_resources/ExportSpecFile.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@
5959
padding-right: 10px;
6060
}
6161

62+
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFileTabs
63+
{
64+
flex-grow: 2;
65+
margin-top: 5px;
66+
}
67+
6268
.ExportSpecFileTool .ExportSpecFileBody .ExportColTitle
6369
{
6470
display: block;
@@ -125,6 +131,13 @@
125131
font-size: 14px;
126132
}
127133

134+
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecSelect
135+
{
136+
margin-left: auto;
137+
margin-right: auto;
138+
margin-top: 10px;
139+
}
140+
128141
.ExportSpecInfo .ExportSpecInfoTable
129142
{
130143
}
@@ -162,6 +175,12 @@
162175
height: 100%;
163176
}
164177

178+
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFormat
179+
{
180+
height: 300px;
181+
overflow-y: auto;
182+
}
183+
165184

166185
.ExportSpecFileTool .ExportSpecFormat .ExportSpecFormatMenu.SideMenu
167186
{
@@ -176,6 +195,12 @@
176195
width: 8.5em;
177196
}
178197

198+
.ExportSpecFileTool.ExportSpecFileToolPhone .ExportSpecFormatMenu.SideMenu
199+
{
200+
margin-left: auto;
201+
margin-right: auto;
202+
}
203+
179204
.ExportSpecFileTool .ExportSpecFormat .ExportSpecFormatMenu.SideMenu li
180205
{
181206
height: 1.25em;

src/ExportSpecFile.cpp

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <Wt/WLineEdit>
4242
#include <Wt/WMenuItem>
4343
#include <Wt/WResource>
44+
#include <Wt/WTabWidget>
4445
#include <Wt/WPushButton>
4546
#include <Wt/Http/Request>
4647
#include <Wt/WApplication>
@@ -739,16 +740,32 @@ void ExportSpecFileTool::init()
739740

740741
const bool showToolTips = InterSpecUser::preferenceValue<bool>( "ShowTooltips", m_interspec );
741742
const bool isMobile = m_interspec && m_interspec->isMobile();
743+
744+
const int screenWidth = m_interspec->renderedWidth();
745+
const bool isPhone = (screenWidth > 100) ? (screenWidth < 640) : m_interspec->isPhone();
742746

743747
if( isMobile )
744748
addStyleClass( "ExportSpecFileToolMobile" );
745749

746-
WContainerWidget *body = new WContainerWidget( this );
747-
body->addStyleClass( "ExportSpecFileBody" );
750+
WTabWidget *mobileTabs = nullptr;
751+
WContainerWidget *body = nullptr;
752+
753+
if( isPhone )
754+
{
755+
addStyleClass( "ExportSpecFileToolPhone" );
756+
mobileTabs = new WTabWidget( this );
757+
mobileTabs->addStyleClass( "ExportSpecFileTabs" );
758+
}else
759+
{
760+
body = new WContainerWidget( this );
761+
body->addStyleClass( "ExportSpecFileBody" );
762+
}
748763

749764

750765
WContainerWidget *fileSelectDiv = new WContainerWidget( body );
751766
fileSelectDiv->addStyleClass( "ExportSpecSelect" );
767+
if( isPhone )
768+
mobileTabs->addTab( fileSelectDiv, "File", Wt::WTabWidget::LoadPolicy::PreLoading );
752769

753770
if( !m_specific_spectrum )
754771
{
@@ -795,6 +812,8 @@ void ExportSpecFileTool::init()
795812
// Spectrum format
796813
WContainerWidget *menuHolder = new WContainerWidget( body );
797814
menuHolder->addStyleClass( "ExportSpecFormat" );
815+
if( isPhone )
816+
mobileTabs->addTab( menuHolder, "Format", Wt::WTabWidget::LoadPolicy::PreLoading );
798817

799818
WText *title = new WText( "File Format", menuHolder );
800819
title->addStyleClass( "ExportColTitle" );
@@ -864,6 +883,10 @@ void ExportSpecFileTool::init()
864883
// Meas/samples to include
865884
m_samplesHolder = new WContainerWidget( body );
866885
m_samplesHolder->addStyleClass( "ExportSpecSamples" );
886+
887+
if( isPhone )
888+
mobileTabs->addTab( m_samplesHolder, "Options", Wt::WTabWidget::LoadPolicy::PreLoading );
889+
867890
title = new WText( "Samples to Include", m_samplesHolder );
868891
title->addStyleClass( "ExportColTitle" );
869892

@@ -3596,9 +3619,16 @@ ExportSpecFileWindow::ExportSpecFileWindow( InterSpec *viewer )
35963619
addStyleClass( "export-spec-file" );
35973620

35983621
const int w = viewer->renderedWidth();
3599-
//setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 800.0) : 800.0 ,WLength::Pixel), WLength::Auto );
3600-
setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 600.0) : 600.0 ,WLength::Pixel), WLength::Auto );
3601-
3622+
const bool isPhone = (w > 100) ? (w < 640) : (viewer && viewer->isPhone());
3623+
3624+
if( isPhone )
3625+
{
3626+
resize( 320, Wt::WLength::Auto ); //320 px is about the smallest width Android phone to expect
3627+
}else
3628+
{
3629+
//setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 800.0) : 800.0 ,WLength::Pixel), WLength::Auto );
3630+
setMinimumSize( WLength(w > 100 ? std::min(0.95*w, 600.0) : 600.0 ,WLength::Pixel), WLength::Auto );
3631+
}
36023632
m_tool = new ExportSpecFileTool( viewer, contents() );
36033633
m_tool->done().connect( boost::bind(&ExportSpecFileWindow::accept, this) );
36043634

src/PeakInfoDisplay.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,8 @@ void PeakInfoDisplay::init()
10791079
}
10801080
}//for( int col = 0; col < m_model->columnCount(); ++col )
10811081

1082-
//#if( !ANDROID && !IOS )
1082+
// For desktop, we'll put a little hint text that users can right-click on peaks for peak editor,
1083+
// But on mobile we'll just treat it as a spacer (which we need so peak CSV link goes to right).
10831084
WString hintTxt = "&nbsp;";
10841085
if( !m_viewer->isPhone() )
10851086
{
@@ -1094,7 +1095,7 @@ void PeakInfoDisplay::init()
10941095
mouseWentOver().connect( show_js );
10951096
mouseWentOut().connect( hide_js );
10961097
txt->doJavaScript( "(" + hide_js + ")();" );
1097-
//#endif
1098+
10981099

10991100
WContainerWidget *csvDiv = new WContainerWidget( bottomDiv );
11001101
csvDiv->addStyleClass( "PeakInfoDisplayCsvBtns" );

0 commit comments

Comments
 (0)