/[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 428 by capela, Mon Mar 7 17:05:55 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 208  void qsamplerMainForm::setup ( qsamplerO Line 213  void qsamplerMainForm::setup ( qsamplerO
213    
214      // Some child forms are to be created right now.      // Some child forms are to be created right now.
215      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
216        m_pDeviceForm = new qsamplerDeviceForm(this);
217      // Set message defaults...      // Set message defaults...
218      updateMessagesFont();      updateMessagesFont();
219      updateMessagesLimit();      updateMessagesLimit();
# Line 236  void qsamplerMainForm::setup ( qsamplerO Line 242  void qsamplerMainForm::setup ( qsamplerO
242          QTextIStream istr(&sDockables);          QTextIStream istr(&sDockables);
243          istr >> *this;          istr >> *this;
244      }      }
245      // Try to restore old window positioning.      // Try to restore old window positioning and initial visibility.
246      m_pOptions->loadWidgetGeometry(this);      m_pOptions->loadWidgetGeometry(this);
247        m_pOptions->loadWidgetGeometry(m_pDeviceForm);
248    
249      // Final startup stabilization...      // Final startup stabilization...
250      updateRecentFilesMenu();      updateRecentFilesMenu();
# Line 264  bool qsamplerMainForm::queryClose (void) Line 271  bool qsamplerMainForm::queryClose (void)
271          // Some windows default fonts is here on demand too.          // Some windows default fonts is here on demand too.
272          if (bQueryClose && m_pMessages)          if (bQueryClose && m_pMessages)
273              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
274                    // Other windows just need asking if it can close gracefully...
275            if (bQueryClose && m_pDeviceForm)
276                    bQueryClose = m_pDeviceForm->queryClose();
277          // Try to save current positioning.          // Try to save current positioning.
278          if (bQueryClose) {          if (bQueryClose) {
279              // Save decorations state.              // Save decorations state.
# Line 275  bool qsamplerMainForm::queryClose (void) Line 285  bool qsamplerMainForm::queryClose (void)
285              QTextOStream ostr(&sDockables);              QTextOStream ostr(&sDockables);
286              ostr << *this;              ostr << *this;
287              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
288              // And the main windows state.              // And the children, and the main windows state,.
289                    m_pOptions->saveWidgetGeometry(m_pDeviceForm);
290              m_pOptions->saveWidgetGeometry(this);              m_pOptions->saveWidgetGeometry(this);
291                    // Close popup widgets.
292                    if (m_pDeviceForm)
293                        m_pDeviceForm->close();
294              // Stop client and/or server, gracefully.              // Stop client and/or server, gracefully.
295              stopServer();              stopServer();
296          }          }
# Line 977  void qsamplerMainForm::viewMessages ( bo Line 991  void qsamplerMainForm::viewMessages ( bo
991  }  }
992    
993    
994    // Show/hide the device configurator form.
995    void qsamplerMainForm::viewDevices (void)
996    {
997        if (m_pOptions == NULL)
998            return;
999    
1000        if (m_pDeviceForm) {
1001            m_pOptions->saveWidgetGeometry(m_pDeviceForm);
1002                    m_pDeviceForm->setClient(m_pClient);
1003            if (m_pDeviceForm->isVisible()) {
1004                m_pDeviceForm->hide();
1005            } else {
1006                m_pDeviceForm->show();
1007                m_pDeviceForm->raise();
1008                m_pDeviceForm->setActiveWindow();
1009            }
1010        }
1011    }
1012    
1013    
1014  // Show options dialog.  // Show options dialog.
1015  void qsamplerMainForm::viewOptions (void)  void qsamplerMainForm::viewOptions (void)
1016  {  {
# Line 1189  void qsamplerMainForm::stabilizeForm (vo Line 1223  void qsamplerMainForm::stabilizeForm (vo
1223      editSetupChannelAction->setEnabled(bHasChannel);      editSetupChannelAction->setEnabled(bHasChannel);
1224      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1225      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
     channelsArrangeAction->setEnabled(bHasChannel);  
1226      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1227        viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());
1228        viewDevicesAction->setEnabled(bHasClient);
1229        channelsArrangeAction->setEnabled(bHasChannel);
1230    
1231      // Client/Server status...      // Client/Server status...
1232      if (bHasClient) {      if (bHasClient) {
1233          m_status[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));          m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));
1234          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));
1235      } else {      } else {
1236          m_status[QSAMPLER_STATUS_CLIENT]->clear();          m_statusItem[QSAMPLER_STATUS_CLIENT]->clear();
1237          m_status[QSAMPLER_STATUS_SERVER]->clear();          m_statusItem[QSAMPLER_STATUS_SERVER]->clear();
1238      }      }
1239      // Channel status...      // Channel status...
1240      if (bHasChannel)      if (bHasChannel)
1241          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());          m_statusItem[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1242      else      else
1243          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_statusItem[QSAMPLER_STATUS_CHANNEL]->clear();
1244      // Session status...      // Session status...
1245      if (m_iDirtyCount > 0)      if (m_iDirtyCount > 0)
1246          m_status[QSAMPLER_STATUS_SESSION]->setText(tr("MOD"));          m_statusItem[QSAMPLER_STATUS_SESSION]->setText(tr("MOD"));
1247      else      else
1248          m_status[QSAMPLER_STATUS_SESSION]->clear();          m_statusItem[QSAMPLER_STATUS_SESSION]->clear();
1249    
1250      // Recent files menu.      // Recent files menu.
1251      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 1898  bool qsamplerMainForm::startClient (void
1898      // Log success here.      // Log success here.
1899      appendMessages(tr("Client connected."));      appendMessages(tr("Client connected."));
1900    
1901            // Hard-notify device configuration form,
1902            // if visible, that we're ready...
1903            if (m_pDeviceForm && m_pDeviceForm->isVisible())
1904                m_pDeviceForm->setClient(m_pClient);
1905                
1906      // Is any session pending to be loaded?      // Is any session pending to be loaded?
1907      if (!m_pOptions->sSessionFile.isEmpty()) {      if (!m_pOptions->sSessionFile.isEmpty()) {
1908          // Just load the prabably startup session...          // Just load the prabably startup session...
# Line 1882  void qsamplerMainForm::stopClient (void) Line 1923  void qsamplerMainForm::stopClient (void)
1923      if (m_pClient == NULL)      if (m_pClient == NULL)
1924          return;          return;
1925    
1926            // Hard-notify device configuration form,
1927            // if visible, that we're running out...
1928            if (m_pDeviceForm && m_pDeviceForm->isVisible())
1929                m_pDeviceForm->setClient(NULL);
1930    
1931      // Log prepare here.      // Log prepare here.
1932      appendMessages(tr("Client disconnecting..."));      appendMessages(tr("Client disconnecting..."));
1933    

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

  ViewVC Help
Powered by ViewVC