Added "Open Recent" button to StartupView.

- Also disabled broken MacOS build in travis CI file
This commit is contained in:
Jim Evins
2019-11-12 21:40:43 -05:00
parent 75e613e9f1
commit f09ca36b7b
17 changed files with 269 additions and 59 deletions
+20 -20
View File
@@ -74,28 +74,28 @@ matrix:
skip_cleanup: true
#####################
# #####################
# #
# # MacOS build
# #
# #####################
# - name: "MacOS"
# os: osx
#
# MacOS build
# install:
# - brew install qt
#
#####################
- name: "MacOS"
os: osx
install:
- brew install qt
before_script:
- git fetch --unshallow # restore repository depth to properly count commits in auto versioning
- git checkout master # re-attach to master to satisfy auto versioning
script:
- mkdir build
- cd build
- cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/qt
- make -j4
#- ctest --verbose
- VERSION=$(cat VERSION)
# before_script:
# - git fetch --unshallow # restore repository depth to properly count commits in auto versioning
# - git checkout master # re-attach to master to satisfy auto versioning
#
# script:
# - mkdir build
# - cd build
# - cmake .. -DCMAKE_PREFIX_PATH=/usr/local/opt/qt
# - make -j4
# #- ctest --verbose
# - VERSION=$(cat VERSION)
# #####################
+15
View File
@@ -402,6 +402,7 @@ namespace glabels
addPixmap( QPixmap( ":icons/flat/16x16/glabels-file-new.svg" ) );
addPixmap( QPixmap( ":icons/flat/22x22/glabels-file-new.svg" ) );
addPixmap( QPixmap( ":icons/flat/24x24/glabels-file-new.svg" ) );
addPixmap( QPixmap( ":icons/flat/32x32/glabels-file-new.svg" ) );
}
};
@@ -414,6 +415,20 @@ namespace glabels
addPixmap( QPixmap( ":icons/flat/16x16/glabels-file-open.svg" ) );
addPixmap( QPixmap( ":icons/flat/22x22/glabels-file-open.svg" ) );
addPixmap( QPixmap( ":icons/flat/24x24/glabels-file-open.svg" ) );
addPixmap( QPixmap( ":icons/flat/32x32/glabels-file-open.svg" ) );
}
};
class FileRecent : public QIcon
{
public:
FileRecent()
{
addPixmap( QPixmap( ":icons/flat/16x16/glabels-file-recent.svg" ) );
addPixmap( QPixmap( ":icons/flat/22x22/glabels-file-recent.svg" ) );
addPixmap( QPixmap( ":icons/flat/24x24/glabels-file-recent.svg" ) );
addPixmap( QPixmap( ":icons/flat/32x32/glabels-file-recent.svg" ) );
}
};
+1 -1
View File
@@ -623,7 +623,7 @@ namespace glabels
fileMenu = menuBar()->addMenu( tr("&File") );
fileMenu->addAction( fileNewAction );
fileMenu->addAction( fileOpenAction );
fileRecentMenu = fileMenu->addMenu( tr("Open Recent") );
fileRecentMenu = fileMenu->addMenu( Icons::FileRecent(), tr("Open Recent") );
for ( auto* action : fileRecentActionList )
{
fileRecentMenu->addAction( action );
+32
View File
@@ -23,6 +23,11 @@
#include "File.h"
#include "MainWindow.h"
#include "model/Settings.h"
#include <QAction>
#include <QFileInfo>
#include <QMenu>
#include <QtDebug>
@@ -39,6 +44,20 @@ namespace glabels
QString titleImage = ":images/glabels-label-designer.png";
titleLabel->setPixmap( QPixmap( titleImage ) );
recentProjectButton->setEnabled( model::Settings::recentFileList().size() > 0 );
auto* recentMenu = new QMenu();
for ( auto& filename : model::Settings::recentFileList() )
{
QString basename = QFileInfo( filename ).completeBaseName();
auto* action = new QAction( basename, this );
action->setData( filename );
connect( action, SIGNAL(triggered()), this, SLOT(onOpenRecentAction()) );
recentMenu->addAction( action );
}
recentMenu->setMinimumWidth( recentProjectButton->minimumWidth() );
recentProjectButton->setMenu( recentMenu );
}
@@ -59,4 +78,17 @@ namespace glabels
File::open( mWindow );
}
///
/// "Open Recent" Action Activated Slot
///
void StartupView::onOpenRecentAction()
{
QAction* action = qobject_cast<QAction*>( sender() );
if ( action )
{
File::open( action->data().toString(), mWindow );
}
}
} // namespace glabels
+1
View File
@@ -53,6 +53,7 @@ namespace glabels
private slots:
void onNewProjectButtonClicked();
void onOpenProjectButtonClicked();
void onOpenRecentAction();
/////////////////////////////////
+6
View File
@@ -21,6 +21,7 @@
<file>icons/flat/16x16/glabels-ellipse.svg</file>
<file>icons/flat/16x16/glabels-file-new.svg</file>
<file>icons/flat/16x16/glabels-file-open.svg</file>
<file>icons/flat/16x16/glabels-file-recent.svg</file>
<file>icons/flat/16x16/glabels-file-save.svg</file>
<file>icons/flat/16x16/glabels-file-save-as.svg</file>
<file>icons/flat/16x16/glabels-flip-horiz.svg</file>
@@ -50,6 +51,7 @@
<file>icons/flat/22x22/glabels-ellipse.svg</file>
<file>icons/flat/22x22/glabels-file-new.svg</file>
<file>icons/flat/22x22/glabels-file-open.svg</file>
<file>icons/flat/22x22/glabels-file-recent.svg</file>
<file>icons/flat/22x22/glabels-file-save.svg</file>
<file>icons/flat/22x22/glabels-file-save-as.svg</file>
<file>icons/flat/22x22/glabels-format-text-bold.svg</file>
@@ -79,6 +81,7 @@
<file>icons/flat/24x24/glabels-ellipse.svg</file>
<file>icons/flat/24x24/glabels-file-new.svg</file>
<file>icons/flat/24x24/glabels-file-open.svg</file>
<file>icons/flat/24x24/glabels-file-recent.svg</file>
<file>icons/flat/24x24/glabels-file-save.svg</file>
<file>icons/flat/24x24/glabels-file-save-as.svg</file>
<file>icons/flat/24x24/glabels-format-text-bold.svg</file>
@@ -92,6 +95,9 @@
<file>icons/flat/24x24/glabels-valign-text-middle.svg</file>
<file>icons/flat/24x24/glabels-valign-text-top.svg</file>
<file>icons/flat/32x32/glabels-file-new.svg</file>
<file>icons/flat/32x32/glabels-file-open.svg</file>
<file>icons/flat/32x32/glabels-file-recent.svg</file>
<file>icons/flat/32x32/glabels-label-orientation-horiz.svg</file>
<file>icons/flat/32x32/glabels-label-orientation-vert.svg</file>
<file>icons/flat/32x32/glabels-print.svg</file>
@@ -5,27 +5,27 @@
d="M 3.5,1.5 3.5,14.5 13.5,14.5 13.5,4.5 10.5,1.5 Z" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="2" width="3" x="5" y="4" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="2" width="3" x="5" y="7" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="2" width="3" x="5" y="10" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="2" width="1" x="9" y="4" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="2" width="3" x="9" y="7" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="2" width="3" x="9" y="10" />
<path

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="16" height="16" >
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
r="6.5" cx="8" cy="8" />
<line
style="stroke:#333333;stroke-width:1;stroke-opacity:1"
x1="8" y1="8" x2="8" y2="3" />
<line
style="stroke:#333333;stroke-width:1;stroke-opacity:1"
x1="8" y1="8" x2="11" y2="6" />
</svg>

After

Width:  |  Height:  |  Size: 428 B

@@ -5,35 +5,35 @@
d="M 4.5,1.5 4.5,19.5 18.5,19.5 18.5,6.5 13.5,1.5 Z" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="6" y="3" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="6" y="7" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="6" y="11" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="6" y="15" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="3" x="12" y="3" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="12" y="7" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="12" y="11" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="12" y="15" />
<path

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="22" height="22" >
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
r="10" cx="11" cy="11" />
<line
style="stroke:#333333;stroke-width:1.5;stroke-opacity:1"
x1="11" y1="11" x2="11" y2="3" />
<line
style="stroke:#333333;stroke-width:1.5;stroke-opacity:1"
x1="11" y1="11" x2="16" y2="8" />
</svg>

After

Width:  |  Height:  |  Size: 438 B

@@ -5,35 +5,35 @@
d="M 5.5,2.5 5.5,20.5 19.5,20.5 19.5,7.5 14.5,2.5 Z" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="7" y="4" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="7" y="8" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="7" y="12" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="7" y="16" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="3" x="13" y="4" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="13" y="8" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="13" y="12" />
<rect
style="fill:#eeeeee;fill-opacity:1;stroke:none"
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="3" width="5" x="13" y="16" />
<path

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="24" height="24" >
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
r="10" cx="12" cy="12" />
<line
style="stroke:#333333;stroke-width:1.5;stroke-opacity:1"
x1="12" y1="12" x2="12" y2="4" />
<line
style="stroke:#333333;stroke-width:1.5;stroke-opacity:1"
x1="12" y1="12" x2="17" y2="9" />
</svg>

After

Width:  |  Height:  |  Size: 438 B

@@ -0,0 +1,43 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<path
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
d="M 7.5,3.5 7.5,27.5 26,27.5 26,10 19.5,3.5 Z" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="9.5" y="6" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="9.5" y="11" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="9.5" y="16" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="9.5" y="21" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="4.5" x="17.5" y="6" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="17.5" y="11" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="17.5" y="16" />
<rect
style="fill:#cccccc;fill-opacity:1;stroke:none"
height="4" width="6.5" x="17.5" y="21" />
<path
style="fill:#fcfcfc;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1;stroke-linejoin:bevel"
d="M 26,10 19.5,3.5 19.5,10 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<path
style="fill:#333333;fill-opacity:1;stroke:none"
d="M 4,4 4,28 28,28 28,6.5 16,6.5 13.5,4 Z" />
<path
style="fill:#efde99;fill-opacity:1;stroke:none"
d="M 5.5,18.5 5.5,26.5 26.5,26.5 26.5,16 14.5,16 12,18.5 Z" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="M 8,10.5 8,17.5 12,17.5 14.5,14.5 24,14.5 24,10.5 Z" />
</svg>

After

Width:  |  Height:  |  Size: 457 B

@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32" >
<circle
style="fill:#ffffff;fill-opacity:1;stroke:#333333;stroke-width:1;stroke-opacity:1"
r="13.5" cx="16" cy="16" />
<line
style="stroke:#333333;stroke-width:1.5;stroke-opacity:1"
x1="16" y1="16" x2="16" y2="5" />
<line
style="stroke:#333333;stroke-width:1.5;stroke-opacity:1"
x1="16" y1="16" x2="22.5" y2="12" />
</svg>

After

Width:  |  Height:  |  Size: 443 B

+35 -9
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>460</width>
<height>397</height>
<height>418</height>
</rect>
</property>
<property name="windowTitle">
@@ -136,16 +136,16 @@
</size>
</property>
<property name="text">
<string>New Project</string>
<string>New...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/24x24/glabels-file-new.svg</normaloff>:/icons/flat/24x24/glabels-file-new.svg</iconset>
<normaloff>:/icons/flat/32x32/glabels-file-new.svg</normaloff>:/icons/flat/32x32/glabels-file-new.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="description">
@@ -168,16 +168,16 @@
</size>
</property>
<property name="text">
<string>Open Project</string>
<string>Browse...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/24x24/glabels-file-open.svg</normaloff>:/icons/flat/24x24/glabels-file-open.svg</iconset>
<normaloff>:/icons/flat/32x32/glabels-file-open.svg</normaloff>:/icons/flat/32x32/glabels-file-open.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="description">
@@ -185,6 +185,32 @@
</property>
</widget>
</item>
<item>
<widget class="QCommandLinkButton" name="recentProjectButton">
<property name="minimumSize">
<size>
<width>319</width>
<height>59</height>
</size>
</property>
<property name="text">
<string>Recent</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/flat/32x32/glabels-file-recent.svg</normaloff>:/icons/flat/32x32/glabels-file-recent.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="description">
<string>Open a recent gLabels project</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
+13 -5
View File
@@ -735,16 +735,24 @@
<source>Welcome to gLabels. Let&apos;s get started:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>New Project</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Create a new blank gLabels project</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Project</source>
<source>Open a recent gLabels project</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recent</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>New...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse...</source>
<translation type="unfinished"></translation>
</message>
<message>