/[svn]/qsampler/trunk/src/qsamplerMainForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.cpp

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

revision 2036 by capela, Wed Jan 6 09:52:32 2010 UTC revision 2038 by capela, Thu Jan 7 18:42:26 2010 UTC
# Line 56  Line 56 
56  #include <QTimer>  #include <QTimer>
57  #include <QDateTime>  #include <QDateTime>
58    
59    #if QT_VERSION < 0x040500
60    namespace Qt {
61    const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);
62    #if QT_VERSION < 0x040200
63    const WindowFlags CustomizeWindowHint   = WindowFlags(0x02000000);
64    #endif
65    }
66    #endif
67    
68  #ifdef HAVE_SIGNAL_H  #ifdef HAVE_SIGNAL_H
69  #include <signal.h>  #include <signal.h>
# Line 375  void MainForm::setup ( Options *pOptions Line 383  void MainForm::setup ( Options *pOptions
383    
384          // What style do we create these forms?          // What style do we create these forms?
385          Qt::WindowFlags wflags = Qt::Window          Qt::WindowFlags wflags = Qt::Window
 #if QT_VERSION >= 0x040200  
386                  | Qt::CustomizeWindowHint                  | Qt::CustomizeWindowHint
 #endif  
387                  | Qt::WindowTitleHint                  | Qt::WindowTitleHint
388                  | Qt::WindowSystemMenuHint                  | Qt::WindowSystemMenuHint
389                  | Qt::WindowMinMaxButtonsHint;                  | Qt::WindowMinMaxButtonsHint
390                    | Qt::WindowCloseButtonHint;
391          if (m_pOptions->bKeepOnTop)          if (m_pOptions->bKeepOnTop)
392                  wflags |= Qt::Tool;                  wflags |= Qt::Tool;
393    
394          // Some child forms are to be created right now.          // Some child forms are to be created right now.
395          m_pMessages = new Messages(this);          m_pMessages = new Messages(this);
396          m_pDeviceForm = new DeviceForm(this, wflags);          m_pDeviceForm = new DeviceForm(this, wflags);
397  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
398          m_pInstrumentListForm = new InstrumentListForm(this, wflags);          m_pInstrumentListForm = new InstrumentListForm(this, wflags);
399  #else  #else
400          viewInstrumentsAction->setEnabled(false);          m_ui.viewInstrumentsAction->setEnabled(false);
401  #endif  #endif
402    
403          // Setup messages logging appropriately...          // Setup messages logging appropriately...
404          m_pMessages->setLogging(          m_pMessages->setLogging(
405                  m_pOptions->bMessagesLog,                  m_pOptions->bMessagesLog,
406                  m_pOptions->sMessagesLogPath);                  m_pOptions->sMessagesLogPath);
407    
408          // Set message defaults...          // Set message defaults...
409          updateMessagesFont();          updateMessagesFont();
410          updateMessagesLimit();          updateMessagesLimit();
# Line 613  void MainForm::customEvent(QEvent* pCust Line 623  void MainForm::customEvent(QEvent* pCust
623          }          }
624  }  }
625    
626  void MainForm::updateViewMidiDeviceStatusMenu() {  
627    void MainForm::updateViewMidiDeviceStatusMenu (void)
628    {
629          m_ui.viewMidiDeviceStatusMenu->clear();          m_ui.viewMidiDeviceStatusMenu->clear();
630          const std::map<int, DeviceStatusForm*> statusForms =          const std::map<int, DeviceStatusForm *> statusForms
631                  DeviceStatusForm::getInstances();                  = DeviceStatusForm::getInstances();
632          for (          std::map<int, DeviceStatusForm *>::const_iterator iter
633                  std::map<int, DeviceStatusForm*>::const_iterator iter = statusForms.begin();                  = statusForms.begin();
634                  iter != statusForms.end(); ++iter          for ( ; iter != statusForms.end(); ++iter) {
635          ) {                  DeviceStatusForm *pStatusForm = iter->second;
                 DeviceStatusForm* pForm = iter->second;  
636                  m_ui.viewMidiDeviceStatusMenu->addAction(                  m_ui.viewMidiDeviceStatusMenu->addAction(
637                          pForm->visibleAction()                          pStatusForm->visibleAction());
                 );  
638          }          }
639  }  }
640    
641    
642  // Context menu event handler.  // Context menu event handler.
643  void MainForm::contextMenuEvent( QContextMenuEvent *pEvent )  void MainForm::contextMenuEvent( QContextMenuEvent *pEvent )
644  {  {
# Line 1870  void MainForm::stabilizeForm (void) Line 1881  void MainForm::stabilizeForm (void)
1881          setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));          setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));
1882    
1883          // Update the main menu state...          // Update the main menu state...
1884          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1885          bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);          bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);
1886          bool bHasChannel = (bHasClient && pChannelStrip != NULL);          bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1887            bool bHasChannels = (bHasClient && m_pWorkspace->windowList().count() > 0);
1888          m_ui.fileNewAction->setEnabled(bHasClient);          m_ui.fileNewAction->setEnabled(bHasClient);
1889          m_ui.fileOpenAction->setEnabled(bHasClient);          m_ui.fileOpenAction->setEnabled(bHasClient);
1890          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 1888  void MainForm::stabilizeForm (void) Line 1900  void MainForm::stabilizeForm (void)
1900          m_ui.editEditChannelAction->setEnabled(false);          m_ui.editEditChannelAction->setEnabled(false);
1901  #endif  #endif
1902          m_ui.editResetChannelAction->setEnabled(bHasChannel);          m_ui.editResetChannelAction->setEnabled(bHasChannel);
1903          m_ui.editResetAllChannelsAction->setEnabled(bHasChannel);          m_ui.editResetAllChannelsAction->setEnabled(bHasChannels);
1904          m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible());          m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible());
1905  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
1906          m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm          m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm
# Line 1900  void MainForm::stabilizeForm (void) Line 1912  void MainForm::stabilizeForm (void)
1912          m_ui.viewDevicesAction->setChecked(m_pDeviceForm          m_ui.viewDevicesAction->setChecked(m_pDeviceForm
1913                  && m_pDeviceForm->isVisible());                  && m_pDeviceForm->isVisible());
1914          m_ui.viewDevicesAction->setEnabled(bHasClient);          m_ui.viewDevicesAction->setEnabled(bHasClient);
1915          m_ui.channelsArrangeAction->setEnabled(bHasChannel);          m_ui.viewMidiDeviceStatusMenu->setEnabled(
1916                    DeviceStatusForm::getInstances().size() > 0);
1917            m_ui.channelsArrangeAction->setEnabled(bHasChannels);
1918    
1919  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
1920          // Toolbar widgets are also affected...          // Toolbar widgets are also affected...

Legend:
Removed from v.2036  
changed lines
  Added in v.2038

  ViewVC Help
Powered by ViewVC