~ubuntu-branches/ubuntu/precise/lmms/precise-updates

« back to all changes in this revision

Viewing changes to src/gui/MainWindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Артём Попов
  • Date: 2011-02-14 20:58:36 UTC
  • mfrom: (1.1.10 upstream) (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110214205836-2u41xus1d2mj8nfz
Tags: 0.4.10-1ubuntu1
* Merge from debian unstable (LP: #718801).  Remaining changes:
  - Replace build-dep on libwine-dev with wine1.2-dev to build
    against the newer Wine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/*
4
4
 * main_window.cpp - implementation of LMMS-main-window
5
5
 *
6
 
 * Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
7
 
 * 
 
6
 * Copyright (c) 2004-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
7
 *
8
8
 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
9
9
 *
10
10
 * This program is free software; you can redistribute it and/or
46
46
#include "embed.h"
47
47
#include "engine.h"
48
48
#include "FxMixerView.h" 
 
49
#include "InstrumentTrack.h"
 
50
#include "PianoView.h"
49
51
#include "about_dialog.h"
50
52
#include "ControllerRackView.h"
51
53
#include "file_browser.h"
60
62
#include "ToolPlugin.h"
61
63
#include "tool_button.h"
62
64
#include "ProjectJournal.h"
63
 
#include "automation_editor.h"
 
65
#include "AutomationEditor.h"
64
66
#include "templates.h"
65
67
 
66
68
 
70
72
        m_workspace( NULL ),
71
73
        m_templatesMenu( NULL ),
72
74
        m_recentlyOpenedProjectsMenu( NULL ),
73
 
        m_toolsMenu( NULL )
 
75
        m_toolsMenu( NULL ),
 
76
        m_autoSaveTimer( this )
74
77
{
75
78
        setAttribute( Qt::WA_DeleteOnClose );
76
79
 
180
183
 
181
184
 
182
185
        m_updateTimer.start( 1000 / 20, this ); // 20 fps
 
186
 
 
187
        // connect auto save
 
188
        connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));
 
189
        m_autoSaveTimer.start(1000 * 60); // 1 minute
183
190
}
184
191
 
185
192
 
475
482
        m_toolBarLayout->addWidget( fx_mixer_window, 1, 5 );
476
483
        m_toolBarLayout->addWidget( project_notes_window, 1, 6 );
477
484
        m_toolBarLayout->addWidget( controllers_window, 1, 7 );
478
 
        m_toolBarLayout->addWidget( controllers_window, 1, 7 );
479
485
        m_toolBarLayout->setColumnStretch( 100, 1 );
480
486
 
481
 
 
482
487
        // setup-dialog opened before?
483
488
        if( !configManager::inst()->value( "app", "configured" ).toInt() )
484
489
        {
726
731
        }
727
732
        else
728
733
        {
729
 
                engine::getSong()->saveProject();
 
734
                engine::getSong()->guiSaveProject();
730
735
        }
731
736
        return( TRUE );
732
737
}
755
760
        if( sfd.exec () == QFileDialog::Accepted &&
756
761
                !sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" )
757
762
        {
758
 
                engine::getSong()->saveProjectAs(
 
763
                engine::getSong()->guiSaveProjectAs(
759
764
                                                sfd.selectedFiles()[0] );
760
765
                return( TRUE );
761
766
        }
856
861
 
857
862
void MainWindow::toggleAutomationEditorWin( void )
858
863
{
859
 
        toggleWindow( engine::getAutomationEditor() );
 
864
        toggleWindow( engine::automationEditor() );
860
865
}
861
866
 
862
867
 
898
903
{
899
904
        if( mayChangeProject() )
900
905
        {
 
906
                // delete recovery file
 
907
                QDir working(configManager::inst()->workingDir());
 
908
                working.remove("recover.mmp");
901
909
                _ce->accept();
902
910
        }
903
911
        else
928
936
                case Qt::Key_Shift: m_keyMods.m_shift = TRUE; break;
929
937
                case Qt::Key_Alt: m_keyMods.m_alt = TRUE; break;
930
938
                default:
931
 
                        QMainWindow::keyPressEvent( _ke );
 
939
                {
 
940
                        InstrumentTrackWindow * w =
 
941
                                                InstrumentTrackView::topLevelInstrumentTrackWindow();
 
942
                        if( w )
 
943
                        {
 
944
                                w->pianoView()->keyPressEvent( _ke );
 
945
                        }
 
946
                        if( !_ke->isAccepted() )
 
947
                        {
 
948
                                QMainWindow::keyPressEvent( _ke );
 
949
                        }
 
950
                }
932
951
        }
933
952
}
934
953
 
943
962
                case Qt::Key_Shift: m_keyMods.m_shift = FALSE; break;
944
963
                case Qt::Key_Alt: m_keyMods.m_alt = FALSE; break;
945
964
                default:
946
 
                        QMainWindow::keyReleaseEvent( _ke );
 
965
                        if( InstrumentTrackView::topLevelInstrumentTrackWindow() )
 
966
                        {
 
967
                                InstrumentTrackView::topLevelInstrumentTrackWindow()->
 
968
                                        pianoView()->keyReleaseEvent( _ke );
 
969
                        }
 
970
                        if( !_ke->isAccepted() )
 
971
                        {
 
972
                                QMainWindow::keyReleaseEvent( _ke );
 
973
                        }
947
974
        }
948
975
}
949
976
 
950
977
 
951
978
 
952
979
 
953
 
void MainWindow::timerEvent( QTimerEvent * )
 
980
void MainWindow::timerEvent( QTimerEvent * _te)
954
981
{
955
982
        emit periodicUpdate();
956
983
}
1018
1045
 
1019
1046
 
1020
1047
 
 
1048
void MainWindow::autoSave()
 
1049
{
 
1050
        QDir work(configManager::inst()->workingDir());
 
1051
        engine::getSong()->saveProjectFile(work.absoluteFilePath("recover.mmp"));
 
1052
}
 
1053
 
 
1054
 
1021
1055
#include "moc_MainWindow.cxx"
1022
1056
 
1023
1057