--- qsampler/trunk/src/qsamplerMainForm.cpp 2007/10/28 23:30:36 1461 +++ qsampler/trunk/src/qsamplerMainForm.cpp 2007/11/04 23:37:47 1470 @@ -1,3 +1,25 @@ +// qsamplerMainForm.cpp +// +/**************************************************************************** + Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2007, Christian Schoenebeck + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +*****************************************************************************/ + #include "qsamplerMainForm.h" #include @@ -108,10 +130,6 @@ MainForm::MainForm(QWidget* parent) : QMainWindow(parent) { ui.setupUi(this); - fileToolbar = addToolBar(tr("File")); - editToolbar = addToolBar(tr("Edit")); - channelsToolbar = addToolBar(tr("Channels")); - // Pseudo-singleton reference setup. g_pMainForm = this; @@ -145,30 +163,31 @@ const QString& sVolumeText = tr("Master volume"); m_iVolumeChanging = 0; // Volume slider... - channelsToolbar->addSeparator(); - m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar); + ui.channelsToolbar->addSeparator(); + m_pVolumeSlider = new QSlider(Qt::Horizontal, ui.channelsToolbar); m_pVolumeSlider->setTickmarks(QSlider::Below); m_pVolumeSlider->setTickInterval(10); m_pVolumeSlider->setPageStep(10); m_pVolumeSlider->setRange(0, 100); - m_pVolumeSlider->setMaximumHeight(22); + m_pVolumeSlider->setMaximumHeight(26); m_pVolumeSlider->setMinimumWidth(160); QToolTip::add(m_pVolumeSlider, sVolumeText); QObject::connect(m_pVolumeSlider, SIGNAL(valueChanged(int)), SLOT(volumeChanged(int))); - //channelsToolbar->setHorizontallyStretchable(true); - //channelsToolbar->setStretchableWidget(m_pVolumeSlider); - channelsToolbar->addWidget(m_pVolumeSlider); + //ui.channelsToolbar->setHorizontallyStretchable(true); + //ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider); + ui.channelsToolbar->addWidget(m_pVolumeSlider); // Volume spin-box - channelsToolbar->addSeparator(); - m_pVolumeSpinBox = new QSpinBox(channelsToolbar); + ui.channelsToolbar->addSeparator(); + m_pVolumeSpinBox = new QSpinBox(ui.channelsToolbar); m_pVolumeSpinBox->setSuffix(" %"); m_pVolumeSpinBox->setRange(0, 100); QToolTip::add(m_pVolumeSpinBox, sVolumeText); QObject::connect(m_pVolumeSpinBox, SIGNAL(valueChanged(int)), SLOT(volumeChanged(int))); + ui.channelsToolbar->addWidget(m_pVolumeSpinBox); #endif // Make it an MDI workspace. @@ -214,6 +233,79 @@ #if defined(WIN32) WSAStartup(MAKEWORD(1, 1), &_wsaData); #endif + + QObject::connect(ui.fileNewAction, + SIGNAL(activated()), + SLOT(fileNew())); + QObject::connect(ui.fileOpenAction, + SIGNAL(activated()), + SLOT(fileOpen())); + QObject::connect(ui.fileSaveAction, + SIGNAL(activated()), + SLOT(fileSave())); + QObject::connect(ui.fileSaveAsAction, + SIGNAL(activated()), + SLOT(fileSaveAs())); + QObject::connect(ui.fileResetAction, + SIGNAL(activated()), + SLOT(fileReset())); + QObject::connect(ui.fileRestartAction, + SIGNAL(activated()), + SLOT(fileRestart())); + QObject::connect(ui.fileExitAction, + SIGNAL(activated()), + SLOT(fileExit())); + QObject::connect(ui.editAddChannelAction, + SIGNAL(activated()), + SLOT(editAddChannel())); + QObject::connect(ui.editRemoveChannelAction, + SIGNAL(activated()), + SLOT(editRemoveChannel())); + QObject::connect(ui.editSetupChannelAction, + SIGNAL(activated()), + SLOT(editSetupChannel())); + QObject::connect(ui.editEditChannelAction, + SIGNAL(activated()), + SLOT(editEditChannel())); + QObject::connect(ui.editResetChannelAction, + SIGNAL(activated()), + SLOT(editResetChannel())); + QObject::connect(ui.editResetAllChannelsAction, + SIGNAL(activated()), + SLOT(editResetAllChannels())); + QObject::connect(ui.viewMenubarAction, + SIGNAL(toggled(bool)), + SLOT(viewMenubar(bool))); + QObject::connect(ui.viewToolbarAction, + SIGNAL(toggled(bool)), + SLOT(viewToolbar(bool))); + QObject::connect(ui.viewStatusbarAction, + SIGNAL(toggled(bool)), + SLOT(viewStatusbar(bool))); + QObject::connect(ui.viewMessagesAction, + SIGNAL(toggled(bool)), + SLOT(viewMessages(bool))); + QObject::connect(ui.viewInstrumentsAction, + SIGNAL(activated()), + SLOT(viewInstruments())); + QObject::connect(ui.viewDevicesAction, + SIGNAL(activated()), + SLOT(viewDevices())); + QObject::connect(ui.viewOptionsAction, + SIGNAL(activated()), + SLOT(viewOptions())); + QObject::connect(ui.channelsArrangeAction, + SIGNAL(activated()), + SLOT(channelsArrange())); + QObject::connect(ui.channelsAutoArrangeAction, + SIGNAL(toggled(bool)), + SLOT(channelsAutoArrange(bool))); + QObject::connect(ui.helpAboutAction, + SIGNAL(activated()), + SLOT(helpAbout())); + QObject::connect(ui.helpAboutQtAction, + SIGNAL(activated()), + SLOT(helpAboutQt())); } // Destructor. @@ -348,7 +440,7 @@ if (bQueryClose) { // Save decorations state. m_pOptions->bMenubar = ui.MenuBar->isVisible(); - m_pOptions->bToolbar = (fileToolbar->isVisible() || editToolbar->isVisible() || channelsToolbar->isVisible()); + m_pOptions->bToolbar = (ui.fileToolbar->isVisible() || ui.editToolbar->isVisible() || ui.channelsToolbar->isVisible()); m_pOptions->bStatusbar = statusBar()->isVisible(); // Save the dock windows state. const QString sDockables = saveState().toBase64().data(); @@ -1344,13 +1436,13 @@ void MainForm::viewToolbar ( bool bOn ) { if (bOn) { - fileToolbar->show(); - editToolbar->show(); - channelsToolbar->show(); + ui.fileToolbar->show(); + ui.editToolbar->show(); + ui.channelsToolbar->show(); } else { - fileToolbar->hide(); - editToolbar->hide(); - channelsToolbar->hide(); + ui.fileToolbar->hide(); + ui.editToolbar->hide(); + ui.channelsToolbar->hide(); } } @@ -1629,6 +1721,7 @@ sText += "
\n"; sText += ""; sText += QSAMPLER_COPYRIGHT "
\n"; + sText += QSAMPLER_COPYRIGHT2 "
\n"; sText += "
\n"; sText += tr("This program is free software; you can redistribute it and/or modify it") + "
\n"; sText += tr("under the terms of the GNU General Public License version 2 or later."); @@ -1710,10 +1803,6 @@ // Recent files menu. m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0); - - // Always make the latest message visible. - if (m_pMessages) - m_pMessages->scrollToBottom(); } @@ -2296,15 +2385,15 @@ //m_pServer->setProcessChannelMode( // QProcess::StandardOutput); QObject::connect(m_pServer, - SIGNAL(readyReadStdout()), + SIGNAL(readyReadStandardOutput()), SLOT(readServerStdout())); QObject::connect(m_pServer, - SIGNAL(readyReadStderr()), + SIGNAL(readyReadStandardError()), SLOT(readServerStdout())); // } // The unforgiveable signal communication... QObject::connect(m_pServer, - SIGNAL(processExited()), + SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(processServerExit())); // Build process arguments... @@ -2519,3 +2608,6 @@ } } // namespace QSampler + + +// end of qsamplerMainForm.cpp