/[svn]/qsampler/trunk/src/qsamplerMainForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 418 by capela, Wed Mar 2 16:23:10 2005 UTC revision 454 by capela, Mon Mar 14 10:59:57 2005 UTC
# Line 41  Line 41 
41  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
42    
43  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
44    
45    #include "qsamplerDeviceForm.h"
46  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
47    
48  #include "config.h"  #include "config.h"
# Line 105  void qsamplerMainForm::init (void) Line 107  void qsamplerMainForm::init (void)
107      m_pOptions = NULL;      m_pOptions = NULL;
108    
109      // All child forms are to be created later, not earlier than setup.      // All child forms are to be created later, not earlier than setup.
110      m_pMessages = NULL;      m_pMessages   = NULL;
111        m_pDeviceForm = NULL;
112    
113      // We'll start clean.      // We'll start clean.
114      m_iUntitled   = 0;      m_iUntitled   = 0;
# Line 138  void qsamplerMainForm::init (void) Line 141  void qsamplerMainForm::init (void)
141      pLabel = new QLabel(tr("Connected"), this);      pLabel = new QLabel(tr("Connected"), this);
142      pLabel->setAlignment(Qt::AlignLeft);      pLabel->setAlignment(Qt::AlignLeft);
143      pLabel->setMinimumSize(pLabel->sizeHint());      pLabel->setMinimumSize(pLabel->sizeHint());
144      m_status[QSAMPLER_STATUS_CLIENT] = pLabel;      m_statusItem[QSAMPLER_STATUS_CLIENT] = pLabel;
145      statusBar()->addWidget(pLabel);      statusBar()->addWidget(pLabel);
146      // Server address.      // Server address.
147      pLabel = new QLabel(this);      pLabel = new QLabel(this);
148      pLabel->setAlignment(Qt::AlignLeft);      pLabel->setAlignment(Qt::AlignLeft);
149      m_status[QSAMPLER_STATUS_SERVER] = pLabel;      m_statusItem[QSAMPLER_STATUS_SERVER] = pLabel;
150      statusBar()->addWidget(pLabel, 1);      statusBar()->addWidget(pLabel, 1);
151      // Channel title.      // Channel title.
152      pLabel = new QLabel(this);      pLabel = new QLabel(this);
153      pLabel->setAlignment(Qt::AlignLeft);      pLabel->setAlignment(Qt::AlignLeft);
154      m_status[QSAMPLER_STATUS_CHANNEL] = pLabel;      m_statusItem[QSAMPLER_STATUS_CHANNEL] = pLabel;
155      statusBar()->addWidget(pLabel, 2);      statusBar()->addWidget(pLabel, 2);
156      // Session modification status.      // Session modification status.
157      pLabel = new QLabel(tr("MOD"), this);      pLabel = new QLabel(tr("MOD"), this);
158      pLabel->setAlignment(Qt::AlignHCenter);      pLabel->setAlignment(Qt::AlignHCenter);
159      pLabel->setMinimumSize(pLabel->sizeHint());      pLabel->setMinimumSize(pLabel->sizeHint());
160      m_status[QSAMPLER_STATUS_SESSION] = pLabel;      m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;
161      statusBar()->addWidget(pLabel);      statusBar()->addWidget(pLabel);
162    
163      // Create the recent files sub-menu.      // Create the recent files sub-menu.
# Line 179  void qsamplerMainForm::destroy (void) Line 182  void qsamplerMainForm::destroy (void)
182  #endif  #endif
183    
184      // Finally drop any widgets around...      // Finally drop any widgets around...
185        if (m_pDeviceForm)
186            delete m_pDeviceForm;
187      if (m_pMessages)      if (m_pMessages)
188          delete m_pMessages;          delete m_pMessages;
189      if (m_pWorkspace)      if (m_pWorkspace)
190          delete m_pWorkspace;          delete m_pWorkspace;
191    
192      // Delete status item labels one by one.      // Delete status item labels one by one.
193      if (m_status[QSAMPLER_STATUS_CLIENT])      if (m_statusItem[QSAMPLER_STATUS_CLIENT])
194          delete m_status[QSAMPLER_STATUS_CLIENT];          delete m_statusItem[QSAMPLER_STATUS_CLIENT];
195      if (m_status[QSAMPLER_STATUS_SERVER])      if (m_statusItem[QSAMPLER_STATUS_SERVER])
196          delete m_status[QSAMPLER_STATUS_SERVER];          delete m_statusItem[QSAMPLER_STATUS_SERVER];
197      if (m_status[QSAMPLER_STATUS_CHANNEL])      if (m_statusItem[QSAMPLER_STATUS_CHANNEL])
198          delete m_status[QSAMPLER_STATUS_CHANNEL];          delete m_statusItem[QSAMPLER_STATUS_CHANNEL];
199      if (m_status[QSAMPLER_STATUS_SESSION])      if (m_statusItem[QSAMPLER_STATUS_SESSION])
200          delete m_status[QSAMPLER_STATUS_SESSION];          delete m_statusItem[QSAMPLER_STATUS_SESSION];
201    
202      // Delete recentfiles menu.      // Delete recentfiles menu.
203      if (m_pRecentFilesMenu)      if (m_pRecentFilesMenu)
# Line 206  void qsamplerMainForm::setup ( qsamplerO Line 211  void qsamplerMainForm::setup ( qsamplerO
211      // We got options?      // We got options?
212      m_pOptions = pOptions;      m_pOptions = pOptions;
213    
214        // What style do we create these forms?
215        WFlags wflags = Qt::WType_TopLevel;
216        if (m_pOptions->bKeepOnTop)
217            wflags |= Qt::WStyle_Tool;
218      // Some child forms are to be created right now.      // Some child forms are to be created right now.
219      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
220        m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
221      // Set message defaults...      // Set message defaults...
222      updateMessagesFont();      updateMessagesFont();
223      updateMessagesLimit();      updateMessagesLimit();
# Line 236  void qsamplerMainForm::setup ( qsamplerO Line 246  void qsamplerMainForm::setup ( qsamplerO
246          QTextIStream istr(&sDockables);          QTextIStream istr(&sDockables);
247          istr >> *this;          istr >> *this;
248      }      }
249      // Try to restore old window positioning.      // Try to restore old window positioning and initial visibility.
250      m_pOptions->loadWidgetGeometry(this);      m_pOptions->loadWidgetGeometry(this);
251        m_pOptions->loadWidgetGeometry(m_pDeviceForm);
252    
253      // Final startup stabilization...      // Final startup stabilization...
254      updateRecentFilesMenu();      updateRecentFilesMenu();
# Line 275  bool qsamplerMainForm::queryClose (void) Line 286  bool qsamplerMainForm::queryClose (void)
286              QTextOStream ostr(&sDockables);              QTextOStream ostr(&sDockables);
287              ostr << *this;              ostr << *this;
288              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
289              // And the main windows state.              // And the children, and the main windows state,.
290                    m_pOptions->saveWidgetGeometry(m_pDeviceForm);
291              m_pOptions->saveWidgetGeometry(this);              m_pOptions->saveWidgetGeometry(this);
292                    // Close popup widgets.
293                    if (m_pDeviceForm)
294                        m_pDeviceForm->close();
295              // Stop client and/or server, gracefully.              // Stop client and/or server, gracefully.
296              stopServer();              stopServer();
297          }          }
# Line 690  bool qsamplerMainForm::saveSessionFile ( Line 705  bool qsamplerMainForm::saveSessionFile (
705  }  }
706    
707    
708    // Session change receiver slot.
709    void qsamplerMainForm::sessionDirty (void)
710    {
711        // Just mark the dirty form.
712        m_iDirtyCount++;
713        // and update the form status...
714        stabilizeForm();
715    }
716    
717    
718  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
719  // qsamplerMainForm -- File Action slots.  // qsamplerMainForm -- File Action slots.
720    
# Line 977  void qsamplerMainForm::viewMessages ( bo Line 1002  void qsamplerMainForm::viewMessages ( bo
1002  }  }
1003    
1004    
1005    // Show/hide the device configurator form.
1006    void qsamplerMainForm::viewDevices (void)
1007    {
1008        if (m_pOptions == NULL)
1009            return;
1010    
1011        if (m_pDeviceForm) {
1012            m_pOptions->saveWidgetGeometry(m_pDeviceForm);
1013                    m_pDeviceForm->setClient(m_pClient);
1014            if (m_pDeviceForm->isVisible()) {
1015                m_pDeviceForm->hide();
1016            } else {
1017                m_pDeviceForm->show();
1018                m_pDeviceForm->raise();
1019                m_pDeviceForm->setActiveWindow();
1020            }
1021        }
1022    }
1023    
1024    
1025  // Show options dialog.  // Show options dialog.
1026  void qsamplerMainForm::viewOptions (void)  void qsamplerMainForm::viewOptions (void)
1027  {  {
# Line 1001  void qsamplerMainForm::viewOptions (void Line 1046  void qsamplerMainForm::viewOptions (void
1046          bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;          bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
1047          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
1048          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
1049            bool    bOldKeepOnTop       = m_pOptions->bKeepOnTop;
1050          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
1051          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;
1052          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
# Line 1013  void qsamplerMainForm::viewOptions (void Line 1059  void qsamplerMainForm::viewOptions (void
1059          if (pOptionsForm->exec()) {          if (pOptionsForm->exec()) {
1060              // Warn if something will be only effective on next run.              // Warn if something will be only effective on next run.
1061              if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||              if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||
1062                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture)) {                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1063                    ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1064                    (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {
1065                  QMessageBox::information(this, tr("Information"),                  QMessageBox::information(this, tr("Information"),
1066                      tr("Some settings may be only effective\n"                      tr("Some settings may be only effective\n"
1067                         "next time you start this program."), tr("OK"));                         "next time you start this program."), tr("OK"));
# Line 1189  void qsamplerMainForm::stabilizeForm (vo Line 1237  void qsamplerMainForm::stabilizeForm (vo
1237      editSetupChannelAction->setEnabled(bHasChannel);      editSetupChannelAction->setEnabled(bHasChannel);
1238      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1239      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
     channelsArrangeAction->setEnabled(bHasChannel);  
1240      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1241        viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());
1242        viewDevicesAction->setEnabled(bHasClient);
1243        channelsArrangeAction->setEnabled(bHasChannel);
1244    
1245      // Client/Server status...      // Client/Server status...
1246      if (bHasClient) {      if (bHasClient) {
1247          m_status[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));          m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));
1248          m_status[QSAMPLER_STATUS_SERVER]->setText(m_pOptions->sServerHost + ":" + QString::number(m_pOptions->iServerPort));          m_statusItem[QSAMPLER_STATUS_SERVER]->setText(m_pOptions->sServerHost + ":" + QString::number(m_pOptions->iServerPort));
1249      } else {      } else {
1250          m_status[QSAMPLER_STATUS_CLIENT]->clear();          m_statusItem[QSAMPLER_STATUS_CLIENT]->clear();
1251          m_status[QSAMPLER_STATUS_SERVER]->clear();          m_statusItem[QSAMPLER_STATUS_SERVER]->clear();
1252      }      }
1253      // Channel status...      // Channel status...
1254      if (bHasChannel)      if (bHasChannel)
1255          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());          m_statusItem[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1256      else      else
1257          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_statusItem[QSAMPLER_STATUS_CHANNEL]->clear();
1258      // Session status...      // Session status...
1259      if (m_iDirtyCount > 0)      if (m_iDirtyCount > 0)
1260          m_status[QSAMPLER_STATUS_SESSION]->setText(tr("MOD"));          m_statusItem[QSAMPLER_STATUS_SESSION]->setText(tr("MOD"));
1261      else      else
1262          m_status[QSAMPLER_STATUS_SESSION]->clear();          m_statusItem[QSAMPLER_STATUS_SESSION]->clear();
1263    
1264      // Recent files menu.      // Recent files menu.
1265      m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0);      m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0);
# Line 1862  bool qsamplerMainForm::startClient (void Line 1912  bool qsamplerMainForm::startClient (void
1912      // Log success here.      // Log success here.
1913      appendMessages(tr("Client connected."));      appendMessages(tr("Client connected."));
1914    
1915            // Hard-notify device configuration form,
1916            // if visible, that we're ready...
1917            if (m_pDeviceForm && m_pDeviceForm->isVisible())
1918                m_pDeviceForm->setClient(m_pClient);
1919                
1920      // Is any session pending to be loaded?      // Is any session pending to be loaded?
1921      if (!m_pOptions->sSessionFile.isEmpty()) {      if (!m_pOptions->sSessionFile.isEmpty()) {
1922          // Just load the prabably startup session...          // Just load the prabably startup session...
# Line 1882  void qsamplerMainForm::stopClient (void) Line 1937  void qsamplerMainForm::stopClient (void)
1937      if (m_pClient == NULL)      if (m_pClient == NULL)
1938          return;          return;
1939    
1940            // Hard-notify device configuration form,
1941            // if visible, that we're running out...
1942            if (m_pDeviceForm && m_pDeviceForm->isVisible())
1943                m_pDeviceForm->setClient(NULL);
1944    
1945      // Log prepare here.      // Log prepare here.
1946      appendMessages(tr("Client disconnecting..."));      appendMessages(tr("Client disconnecting..."));
1947    

Legend:
Removed from v.418  
changed lines
  Added in v.454

  ViewVC Help
Powered by ViewVC