Skip to content

Commit 7211a4c

Browse files
zonkmachinePhysSong
authored andcommitted
Some fixes to recent files (LMMS#3621)
* Add a factory default data/projects/templates/default.mpt. Fixes LMMS#528 * On launch, if the last project was a template we create a new project (default.mpt) instead. * If there is a recovery file present and you discard it we create a new project as the project launched could be defective or, if .lmmsrc.xml wasn't written, an earlier project.
1 parent 6f0148a commit 7211a4c

File tree

4 files changed

+102
-5
lines changed

4 files changed

+102
-5
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE lmms-project>
3+
<lmms-project version="1.0" creator="LMMS" creatorversion="1.2.0" type="song">
4+
<head timesig_numerator="4" mastervol="100" timesig_denominator="4" bpm="140" masterpitch="0"/>
5+
<song>
6+
<trackcontainer width="600" x="5" y="5" maximized="0" height="300" visible="1" type="song" minimized="0">
7+
<track muted="0" type="0" name="TripleOscillator" solo="0">
8+
<instrumenttrack pan="0" fxch="0" usemasterpitch="1" pitchrange="1" pitch="0" basenote="57" vol="100">
9+
<instrument name="tripleoscillator">
10+
<tripleoscillator phoffset2="0" userwavefile0="" finer0="0" userwavefile1="" finer1="0" userwavefile2="" finer2="0" coarse0="0" coarse1="-12" coarse2="-24" finel0="0" finel1="0" modalgo1="2" modalgo2="2" finel2="0" pan0="0" modalgo3="2" pan1="0" stphdetun0="0" pan2="0" stphdetun1="0" wavetype0="0" stphdetun2="0" wavetype1="0" wavetype2="0" vol0="33" vol1="33" phoffset0="0" phoffset1="0" vol2="33"/>
11+
</instrument>
12+
<eldata fres="0.5" ftype="0" fcut="14000" fwet="0">
13+
<elvol lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lspd_syncmode="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
14+
<elcut lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lspd_syncmode="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
15+
<elres lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lspd_syncmode="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
16+
</eldata>
17+
<chordcreator chord="0" chordrange="1" chord-enabled="0"/>
18+
<arpeggiator arptime="100" arprange="1" arpskip="0" arptime_denominator="4" arptime_syncmode="0" arpmode="0" arpcycle="0" arp-enabled="0" arp="0" arptime_numerator="4" arpdir="0" arpmiss="0" arpgate="100"/>
19+
<midiport inputcontroller="0" fixedoutputvelocity="-1" inputchannel="0" outputcontroller="0" writable="0" outputchannel="1" fixedinputvelocity="-1" fixedoutputnote="-1" outputprogram="1" basevelocity="63" readable="0"/>
20+
<fxchain numofeffects="0" enabled="0"/>
21+
</instrumenttrack>
22+
</track>
23+
<track muted="0" type="2" name="Sample track" solo="0">
24+
<sampletrack pan="0" vol="100">
25+
<fxchain numofeffects="0" enabled="0"/>
26+
</sampletrack>
27+
</track>
28+
<track muted="0" type="1" name="Beat/Bassline 0" solo="0">
29+
<bbtrack>
30+
<trackcontainer width="640" x="610" y="5" maximized="0" height="400" visible="0" type="bbtrackcontainer" minimized="0">
31+
<track muted="0" type="0" name="Kicker" solo="0">
32+
<instrumenttrack pan="0" fxch="0" usemasterpitch="1" pitchrange="1" pitch="0" basenote="57" vol="100">
33+
<instrument name="kicker">
34+
<kicker decay_numerator="4" decay_denominator="4" distend="0.8" click="0.4" endnote="0" version="1" decay_syncmode="0" decay="440" noise="0" slope="0.06" dist="0.8" env="0.163" startnote="1" startfreq="150" endfreq="40" gain="1"/>
35+
</instrument>
36+
<eldata fres="0.5" ftype="0" fcut="14000" fwet="0">
37+
<elvol lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lspd_syncmode="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
38+
<elcut lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lspd_syncmode="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
39+
<elres lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lspd_syncmode="0" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
40+
</eldata>
41+
<chordcreator chord="0" chordrange="1" chord-enabled="0"/>
42+
<arpeggiator arptime="100" arprange="1" arpskip="0" arptime_denominator="4" arptime_syncmode="0" arpmode="0" arpcycle="0" arp-enabled="0" arp="0" arptime_numerator="4" arpdir="0" arpmiss="0" arpgate="100"/>
43+
<midiport inputcontroller="0" fixedoutputvelocity="-1" inputchannel="0" outputcontroller="0" writable="0" outputchannel="1" fixedinputvelocity="-1" fixedoutputnote="-1" outputprogram="1" basevelocity="63" readable="0"/>
44+
<fxchain numofeffects="0" enabled="0"/>
45+
</instrumenttrack>
46+
<pattern steps="16" muted="0" type="0" name="Kicker" pos="0"/>
47+
</track>
48+
</trackcontainer>
49+
</bbtrack>
50+
</track>
51+
<track muted="0" type="5" name="Automation track" solo="0">
52+
<automationtrack/>
53+
</track>
54+
</trackcontainer>
55+
<track muted="0" type="6" name="Automation track" solo="0">
56+
<automationtrack/>
57+
<automationpattern tens="1" mute="0" prog="0" name="Numerator" pos="0" len="192">
58+
<object id="4975896"/>
59+
</automationpattern>
60+
<automationpattern tens="1" mute="0" prog="0" name="Denominator" pos="0" len="192">
61+
<object id="6613237"/>
62+
</automationpattern>
63+
<automationpattern tens="1" mute="0" prog="0" name="Tempo" pos="0" len="192">
64+
<object id="6054005"/>
65+
</automationpattern>
66+
<automationpattern tens="1" mute="0" prog="0" name="Master volume" pos="0" len="192">
67+
<object id="1345820"/>
68+
</automationpattern>
69+
<automationpattern tens="1" mute="0" prog="0" name="Master pitch" pos="0" len="192">
70+
<object id="5865711"/>
71+
</automationpattern>
72+
</track>
73+
<fxmixer width="543" x="5" y="310" maximized="0" height="335" visible="1" minimized="0">
74+
<fxchannel num="0" muted="0" volume="1" name="Master" soloed="0">
75+
<fxchain numofeffects="0" enabled="0"/>
76+
</fxchannel>
77+
</fxmixer>
78+
<ControllerRackView width="350" x="680" y="310" maximized="0" height="200" visible="1" minimized="0"/>
79+
<pianoroll width="640" x="5" y="5" maximized="0" height="480" visible="0" minimized="0"/>
80+
<automationeditor width="640" x="-36" y="0" maximized="0" height="400" visible="0" minimized="0"/>
81+
<projectnotes width="640" x="700" y="10" maximized="0" height="400" visible="0" minimized="0"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
82+
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
83+
p, li { white-space: pre-wrap; }
84+
</style></head><body style=" font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;">
85+
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#e0e0e0;">Enter project notes here</span></p></body></html>]]></projectnotes>
86+
<timeline lp1pos="192" lp0pos="0" lpstate="0"/>
87+
<controllers/>
88+
</song>
89+
</lmms-project>

src/core/ConfigManager.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ void ConfigManager::addRecentlyOpenedProject( const QString & file )
282282
{
283283
QFileInfo recentFile( file );
284284
if( recentFile.suffix().toLower() == "mmp" ||
285-
recentFile.suffix().toLower() == "mmpz" )
285+
recentFile.suffix().toLower() == "mmpz" ||
286+
recentFile.suffix().toLower() == "mpt" )
286287
{
287288
m_recentlyOpenedProjects.removeAll( file );
288289
if( m_recentlyOpenedProjects.size() > 50 )

src/core/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,13 +846,15 @@ int main( int argc, char * * argv )
846846
else if( ConfigManager::inst()->
847847
value( "app", "openlastproject" ).toInt() &&
848848
!ConfigManager::inst()->
849-
recentlyOpenedProjects().isEmpty() )
849+
recentlyOpenedProjects().isEmpty() &&
850+
!recoveryFilePresent )
850851
{
851852
QString f = ConfigManager::inst()->
852853
recentlyOpenedProjects().first();
853854
QFileInfo recentFile( f );
854855

855-
if ( recentFile.exists() )
856+
if ( recentFile.exists() &&
857+
recentFile.suffix().toLower() != "mpt" )
856858
{
857859
Engine::getSong()->loadProject( f );
858860
}

src/gui/MainWindow.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,15 +876,20 @@ void MainWindow::updateRecentlyOpenedProjectsMenu()
876876
m_recentlyOpenedProjectsMenu->clear();
877877
QStringList rup = ConfigManager::inst()->recentlyOpenedProjects();
878878

879-
// The file history goes 30 deep but we only show the 15
880-
// most recent ones that we can open.
879+
// The file history goes 50 deep but we only show the 15
880+
// most recent ones that we can open and omit .mpt files.
881881
int shownInMenu = 0;
882882
for( QStringList::iterator it = rup.begin(); it != rup.end(); ++it )
883883
{
884884
QFileInfo recentFile( *it );
885885
if ( recentFile.exists() &&
886886
*it != ConfigManager::inst()->recoveryFile() )
887887
{
888+
if( recentFile.suffix().toLower() == "mpt" )
889+
{
890+
continue;
891+
}
892+
888893
m_recentlyOpenedProjectsMenu->addAction(
889894
embed::getIconPixmap( "project_file" ), *it );
890895
#ifdef LMMS_BUILD_APPLE

0 commit comments

Comments
 (0)