|
29 | 29 | #include <string> |
30 | 30 | #include <vector> |
31 | 31 | #include <fstream> |
| 32 | +#include <algorithm> |
32 | 33 |
|
33 | 34 | #include <boost/tokenizer.hpp> |
34 | 35 | #include <boost/filesystem.hpp> |
@@ -684,15 +685,23 @@ void RelEffDetSelect::saveFilePathToUserPreferences() |
684 | 685 |
|
685 | 686 | auto children = m_files->children(); |
686 | 687 |
|
687 | | - string concat_path; |
| 688 | + vector<string> paths; |
688 | 689 | for( auto w : children ) |
689 | 690 | { |
690 | 691 | auto child = dynamic_cast<RelEffFile *>( w ); |
691 | 692 | const string filepath = child ? child->filepath() : string(""); |
692 | 693 | if( filepath.size() ) |
693 | | - concat_path += (concat_path.size() ? ";" : "") + filepath; |
| 694 | + paths.push_back( filepath ); |
| 695 | + //concat_path += (concat_path.size() ? ";" : "") + filepath; |
694 | 696 | }//string concat_path; |
695 | 697 |
|
| 698 | + //Make sure we only save unique paths |
| 699 | + paths.erase( std::unique( begin(paths), end(paths) ), end(paths) ); |
| 700 | + |
| 701 | + string concat_path; |
| 702 | + for( const auto &filepath : paths ) |
| 703 | + concat_path += (concat_path.size() ? ";" : "") + filepath; |
| 704 | + |
696 | 705 | try |
697 | 706 | { |
698 | 707 | InterSpecUser::setPreferenceValue( m_interspec->m_user, "RelativeEffDRFPaths", concat_path, m_interspec ); |
@@ -797,6 +806,9 @@ void RelEffDetSelect::docreate() |
797 | 806 |
|
798 | 807 | SpecUtils::split( paths, pathstr, "\r\n;" ); |
799 | 808 |
|
| 809 | + //Eliminate any duplicate entries in paths |
| 810 | + paths.erase( std::unique( begin(paths), end(paths) ), end(paths) ); |
| 811 | + |
800 | 812 | if( paths.empty() ) |
801 | 813 | new RelEffFile( "", this, m_detectorEdit, m_files ); |
802 | 814 |
|
@@ -1749,7 +1761,7 @@ DetectorEdit::DetectorEdit( std::shared_ptr<DetectorPeakResponse> currentDet, |
1749 | 1761 | lowerContent->resize( WLength::Auto, WLength(190,WLength::Pixel) ); |
1750 | 1762 |
|
1751 | 1763 | m_drfTypeStack = new Wt::WStackedWidget(); |
1752 | | - m_drfTypeStack->addStyleClass( "UseInfoStack" ); |
| 1764 | + m_drfTypeStack->addStyleClass( "UseInfoStack DetEditContent" ); |
1753 | 1765 |
|
1754 | 1766 | m_drfTypeMenu = new WMenu( m_drfTypeStack, Wt::Vertical ); |
1755 | 1767 | m_drfTypeMenu->addStyleClass( "VerticalMenu SideMenu DetEditMenu" ); |
@@ -1939,9 +1951,8 @@ DetectorEdit::DetectorEdit( std::shared_ptr<DetectorPeakResponse> currentDet, |
1939 | 1951 | //--- 5) Recent |
1940 | 1952 | //------------------------------------- |
1941 | 1953 | WContainerWidget *recentDiv = new WContainerWidget( ); |
1942 | | - WGridLayout* recentDivLayout = new WGridLayout(); |
| 1954 | + WGridLayout* recentDivLayout = new WGridLayout( recentDiv ); |
1943 | 1955 | recentDivLayout->setContentsMargins( 0, 0, 0, 0 ); |
1944 | | - recentDiv->setLayout(recentDivLayout); |
1945 | 1956 |
|
1946 | 1957 | Dbo::ptr<InterSpecUser> user = m_interspec->m_user; |
1947 | 1958 |
|
@@ -2059,9 +2070,9 @@ DetectorEdit::DetectorEdit( std::shared_ptr<DetectorPeakResponse> currentDet, |
2059 | 2070 |
|
2060 | 2071 | recentDivLayout->addWidget( filter, 1, 2 ); |
2061 | 2072 | recentDivLayout->setRowStretch( 0, 1 ); |
2062 | | - recentDiv->setOverflow(Wt::WContainerWidget::OverflowHidden); |
2063 | | - recentDiv->setMaximumSize( WLength::Auto, 180 ); |
2064 | | - |
| 2073 | + //recentDiv->setOverflow(Wt::WContainerWidget::OverflowHidden); |
| 2074 | + //recentDiv->setMaximumSize( WLength::Auto, 180 ); |
| 2075 | + recentDiv->setHeight( WLength( 100, WLength::Unit::Percentage ) ); |
2065 | 2076 | m_DBtable->sortByColumn( 2, Wt::SortOrder::DescendingOrder ); |
2066 | 2077 |
|
2067 | 2078 | //-------------------------------------------------------------------------------- |
|
0 commit comments