MainWindow: coding style improvements

This commit is contained in:
Tobias Doerffel
2014-03-18 20:34:34 +01:00
parent a4b328e28f
commit b45c0c5f02
5 changed files with 82 additions and 73 deletions

View File

@@ -1,8 +1,8 @@
/*
* main_window.h - declaration of class MainWindow, the main window of LMMS
* MainWindow.h - declaration of class MainWindow, the main window of LMMS
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* Copyright (c) 2004-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -22,15 +22,13 @@
*
*/
#ifndef _MAIN_WINDOW_H
#define _MAIN_WINDOW_H
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include <QtCore/QBasicTimer>
#include <QtCore/QTimer>
#include <QtCore/QList>
#include <QtGui/QMainWindow>
#include <QtGui/QWhatsThis>
class QAction;
class QDomElement;
@@ -46,14 +44,14 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
public:
inline QMdiArea * workspace( void )
QMdiArea* workspace()
{
return( m_workspace );
return m_workspace;
}
inline QWidget * toolBar( void )
QWidget* toolBar()
{
return( m_toolBar );
return m_toolBar;
}
int addWidgetToToolBar( QWidget * _w, int _row = -1, int _col = -1 );
@@ -63,24 +61,24 @@ public:
// every function that replaces current file (e.g. creates new file,
// opens another file...) has to call this before and may only process
// if this function returns true
bool mayChangeProject( void );
bool mayChangeProject();
void clearKeyModifiers( void );
void clearKeyModifiers();
inline bool isCtrlPressed( void )
bool isCtrlPressed()
{
return( m_keyMods.m_ctrl );
return m_keyMods.m_ctrl;
}
inline bool isShiftPressed( void )
bool isShiftPressed()
{
return( m_keyMods.m_shift );
return m_keyMods.m_shift;
}
inline bool isAltPressed( void )
bool isAltPressed()
{
return( m_keyMods.m_alt );
return m_keyMods.m_alt;
}
static void saveWidgetState( QWidget * _w, QDomElement & _de );
@@ -88,34 +86,29 @@ public:
public slots:
void resetWindowTitle( void );
void resetWindowTitle();
inline void emptySlot( void )
{
}
inline void enterWhatsThisMode( void )
{
QWhatsThis::enterWhatsThisMode();
}
void createNewProject( void );
void emptySlot();
void enterWhatsThisMode();
void createNewProject();
void createNewProjectFromTemplate( QAction * _idx );
void openProject( void );
bool saveProject( void );
bool saveProjectAs( void );
bool saveProjectAsNewVersion( void );
void showSettingsDialog( void );
void aboutLMMS( void );
void help( void );
void toggleAutomationEditorWin( void );
void openProject();
bool saveProject();
bool saveProjectAs();
bool saveProjectAsNewVersion();
void showSettingsDialog();
void aboutLMMS();
void help();
void toggleAutomationEditorWin();
void toggleBBEditorWin( bool forceShow = false );
void toggleSongEditorWin( void );
void toggleProjectNotesWin( void );
void toggleFxMixerWin( void );
void togglePianoRollWin( void );
void toggleControllerRack( void );
void toggleSongEditorWin();
void toggleProjectNotesWin();
void toggleFxMixerWin();
void togglePianoRollWin();
void toggleControllerRack();
void undo( void );
void redo( void );
void undo();
void redo();
protected:
@@ -127,11 +120,11 @@ protected:
private:
MainWindow( void );
MainWindow();
MainWindow( const MainWindow & );
virtual ~MainWindow();
void finalize( void );
void finalize();
void toggleWindow( QWidget *window, bool forceShow = false );
@@ -169,17 +162,17 @@ private:
private slots:
void browseHelp( void );
void fillTemplatesMenu( void );
void browseHelp();
void fillTemplatesMenu();
void openRecentlyOpenedProject( QAction * _action );
void showTool( QAction * _idx );
void updateRecentlyOpenedProjectsMenu( void );
void updateRecentlyOpenedProjectsMenu();
void autoSave();
signals:
void periodicUpdate( void );
void periodicUpdate();
} ;

View File

@@ -33,6 +33,7 @@
#include <QtGui/QMenuBar>
#include <QtGui/QMessageBox>
#include <QtGui/QSplitter>
#include <QtGui/QWhatsThis>
#include "lmmsversion.h"
#include "MainWindow.h"
@@ -67,7 +68,7 @@
MainWindow::MainWindow( void ) :
MainWindow::MainWindow() :
m_workspace( NULL ),
m_templatesMenu( NULL ),
m_recentlyOpenedProjectsMenu( NULL ),
@@ -211,7 +212,7 @@ MainWindow::~MainWindow()
void MainWindow::finalize( void )
void MainWindow::finalize()
{
resetWindowTitle();
setWindowIcon( embed::getIconPixmap( "icon" ) );
@@ -542,7 +543,7 @@ void MainWindow::addSpacingToToolBar( int _size )
void MainWindow::resetWindowTitle( void )
void MainWindow::resetWindowTitle()
{
QString title = "";
if( engine::getSong()->projectFileName() != "" )
@@ -564,7 +565,7 @@ void MainWindow::resetWindowTitle( void )
bool MainWindow::mayChangeProject( void )
bool MainWindow::mayChangeProject()
{
engine::getSong()->stop();
@@ -599,7 +600,7 @@ bool MainWindow::mayChangeProject( void )
void MainWindow::clearKeyModifiers( void )
void MainWindow::clearKeyModifiers()
{
m_keyMods.m_ctrl = FALSE;
m_keyMods.m_shift = FALSE;
@@ -658,8 +659,20 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
void MainWindow::emptySlot()
{
}
void MainWindow::createNewProject( void )
void MainWindow::enterWhatsThisMode()
{
QWhatsThis::enterWhatsThisMode();
}
void MainWindow::createNewProject()
{
if( mayChangeProject() )
{
@@ -708,7 +721,7 @@ void MainWindow::openProject()
void MainWindow::updateRecentlyOpenedProjectsMenu( void )
void MainWindow::updateRecentlyOpenedProjectsMenu()
{
m_recentlyOpenedProjectsMenu->clear();
QStringList rup = configManager::inst()->recentlyOpenedProjects();
@@ -734,7 +747,7 @@ void MainWindow::openRecentlyOpenedProject( QAction * _action )
bool MainWindow::saveProject( void )
bool MainWindow::saveProject()
{
if( engine::getSong()->projectFileName() == "" )
{
@@ -750,7 +763,7 @@ bool MainWindow::saveProject( void )
bool MainWindow::saveProjectAs( void )
bool MainWindow::saveProjectAs()
{
VersionedSaveDialog sfd( this, tr( "Save project" ), "",
tr( "LMMS Project (*.mmpz *.mmp);;"
@@ -779,7 +792,7 @@ bool MainWindow::saveProjectAs( void )
bool MainWindow::saveProjectAsNewVersion( void )
bool MainWindow::saveProjectAsNewVersion()
{
QString fileName = engine::getSong()->projectFileName();
if( fileName == "" )
@@ -799,7 +812,7 @@ bool MainWindow::saveProjectAsNewVersion( void )
void MainWindow::showSettingsDialog( void )
void MainWindow::showSettingsDialog()
{
setupDialog sd;
sd.exec();
@@ -808,7 +821,7 @@ void MainWindow::showSettingsDialog( void )
void MainWindow::aboutLMMS( void )
void MainWindow::aboutLMMS()
{
aboutDialog().exec();
}
@@ -816,7 +829,7 @@ void MainWindow::aboutLMMS( void )
void MainWindow::help( void )
void MainWindow::help()
{
QMessageBox::information( this, tr( "Help not available" ),
tr( "Currently there's no help "
@@ -865,7 +878,7 @@ void MainWindow::toggleBBEditorWin( bool forceShow )
void MainWindow::toggleSongEditorWin( void )
void MainWindow::toggleSongEditorWin()
{
toggleWindow( engine::songEditor() );
}
@@ -873,7 +886,7 @@ void MainWindow::toggleSongEditorWin( void )
void MainWindow::toggleProjectNotesWin( void )
void MainWindow::toggleProjectNotesWin()
{
toggleWindow( engine::getProjectNotes() );
}
@@ -881,7 +894,7 @@ void MainWindow::toggleProjectNotesWin( void )
void MainWindow::togglePianoRollWin( void )
void MainWindow::togglePianoRollWin()
{
toggleWindow( engine::pianoRoll() );
}
@@ -889,7 +902,7 @@ void MainWindow::togglePianoRollWin( void )
void MainWindow::toggleAutomationEditorWin( void )
void MainWindow::toggleAutomationEditorWin()
{
toggleWindow( engine::automationEditor() );
}
@@ -897,7 +910,7 @@ void MainWindow::toggleAutomationEditorWin( void )
void MainWindow::toggleFxMixerWin( void )
void MainWindow::toggleFxMixerWin()
{
toggleWindow( engine::fxMixerView() );
}
@@ -905,7 +918,7 @@ void MainWindow::toggleFxMixerWin( void )
void MainWindow::toggleControllerRack( void )
void MainWindow::toggleControllerRack()
{
toggleWindow( engine::getControllerRackView() );
}
@@ -913,7 +926,7 @@ void MainWindow::toggleControllerRack( void )
void MainWindow::undo( void )
void MainWindow::undo()
{
engine::projectJournal()->undo();
}
@@ -921,7 +934,7 @@ void MainWindow::undo( void )
void MainWindow::redo( void )
void MainWindow::redo()
{
engine::projectJournal()->redo();
}
@@ -1015,7 +1028,7 @@ void MainWindow::timerEvent( QTimerEvent * _te)
void MainWindow::fillTemplatesMenu( void )
void MainWindow::fillTemplatesMenu()
{
m_templatesMenu->clear();
@@ -1064,7 +1077,7 @@ void MainWindow::showTool( QAction * _idx )
void MainWindow::browseHelp( void )
void MainWindow::browseHelp()
{
// file:// alternative for offline help
QString url = "http://lmms.sf.net/wiki/index.php?title=Main_Page";

View File

@@ -2,7 +2,7 @@
* ControllerView.cpp - view-component for an controller
*
* Copyright (c) 2008-2009 Paul Giblock <drfaygo/at/gmail.com>
* Copyright (c) 2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2011-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -30,6 +30,7 @@
#include <QtGui/QMdiSubWindow>
#include <QtGui/QPainter>
#include <QtGui/QInputDialog>
#include <QtGui/QWhatsThis>
#include "ControllerView.h"

View File

@@ -28,6 +28,7 @@
#include <QtGui/QMdiArea>
#include <QtGui/QMdiSubWindow>
#include <QtGui/QPainter>
#include <QtGui/QWhatsThis>
#include "EffectView.h"
#include "caption_menu.h"

View File

@@ -29,6 +29,7 @@
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <QtGui/QPalette>
#include <QtGui/QWhatsThis>
#ifndef __USE_XOPEN
#define __USE_XOPEN