Logo Search packages:      
Sourcecode: qasmixer version File versions  Download package

main_mixer_window.hpp

//
// C++ Interface:
//
// Description:
//
//
// Author: Sebastian Holtermann <sebholt@xwmw.org>, (C) 2010-2011
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef __INC_main_mixer_window_hpp__
#define __INC_main_mixer_window_hpp__

#include "config.hpp"

#include <QMainWindow>
#include <QMenuBar>
#include <QStatusBar>
#include <QSplitter>
#include <QLabel>
#include <QActionGroup>

#include <QPointer>
#include <QSystemTrayIcon>

#include "qsnd/mixer_style.hpp"
#include "mixer_settings.hpp"

#include "mini_mixer.hpp"
#include "main_view.hpp"
#include "device_selection.hpp"
#include "dialog_settings.hpp"
#include "mixer_toolbar.hpp"


00038 class Main_Mixer_Window :
      public QMainWindow
{
      Q_OBJECT

      // Public methods
      public:

      Main_Mixer_Window (
            QWidget * parent_n = 0,
            Qt::WindowFlags flags_n = 0 );

      ~Main_Mixer_Window ( );


      Mini_Mixer &
      mini_mixer ( );

      const Mixer_Settings &
      settings ( ) const;


      unsigned int
      view_type ( ) const;

      unsigned int
      num_view_types ( ) const;


      const QSnd::Snd_Control_Address &
      current_ctl ( ) const;

      void
      select_ctl (
            const QSnd::Snd_Control_Address & ctl_n );

      void
      select_default_ctl ( );


      bool
      setup_stage ( ) const;

      void
      enter_setup_stage ( );

      void
      finish_setup_stage ( );

      bool
      is_minimized_in_tray ( ) const;


      bool
      eventFilter (
            QObject * obj_n,
            QEvent * event_n );


      // Signals
      signals:

      void
      sig_full_close ( );


      // Public slots
      public slots:

      // View type selection

      void
      select_view_simple_mixer ( );

      void
      select_view_element_mixer ( );

      void
      select_view_control_info ( );

      void
      select_view_type (
            unsigned int type_n );

      void
      select_view_type_int (
            int type_n );


      void
      select_ctl_from_side_iface ( );


      void
      refresh_data ( );


      // Fullscreen and tray mode

      void
      set_fullscreen (
            bool flag_n );

      bool
      minimize_to_tray ( );

      void
      raise_from_tray ( );


      void
      save_settings ( );

      void
      silent_close ( );

      void
      force_close ( );


      // Toolbars

      void
      show_view_type_selection (
            bool flag_n );

      void
      show_mixer_controls (
            bool flag_n );

      void
      show_device_selection (
            bool flag_n );

      void
      toggle_device_selection ( );

      void
      toggle_mixer_controls ( );

      void
      toggle_view_type_selection ( );


      // Dialogs

      void
      show_dialog_info ( );

      void
      show_dialog_settings ( );

      void
      show_dialog_alsa_config ( );

      void
      adjust_dialog_size (
            QWidget * dialog_n,
            unsigned int numerator_n,
            unsigned int denominator_n );


      void
      parse_message (
            QString msg_n );


      // Protected slots
      protected slots:

      void
      view_type_action_triggered (
            QAction * act_n );

      void
      settings_changed_mixer ( );

      void
      settings_changed_tray ( );

      void
      settings_changed_mini_mixer ( );


      void
      tray_icon_activation ( );


      // Protected methods
      protected:

      void
      clear_view ( );

      void
      create_view ( );

      void
      reload_mini_mixer ( );

      void
      update_fullscreen_action ( );


      void
      keyPressEvent (
            QKeyEvent * event_n );

      void
      contextMenuEvent (
            QContextMenuEvent * event_n );

      void
      changeEvent (
            QEvent * event_n );

      void
      closeEvent (
            QCloseEvent * event_n );


      void
      update_settings_dialog ( );

      void
      update_visibility_toolbars ( );

      void
      update_visibility_tray_icon ( );


      void
      init_menus ( );

      void
      init_toolbars ( );

      void
      init_docks ( );

      void
      init_mini_mixer ( );


      // Private attributes
      private:

      // Shared storages and settings
      QSnd::Mixer_Style _mixer_style;
      Mixer_Settings _settings;


      // Base widgets
      QWidget _wdg_view;
      Device_Selection * _device_iface;
      Mixer_Toolbar * _mixer_controls_tbar;
      Mixer_Toolbar * _view_type_tbar;

      // View stuff
      static const unsigned int _num_view_types = 3;
      unsigned int _view_type;
      QActionGroup * _act_grp_tbar_vtype;
      Main_View * _view;
      QString _view_names[_num_view_types];
      QSnd::Snd_Control_Address _current_ctl;


      // Menubar
      QIcon _icons_vtype[3];
      QMenu * _menu_mixer;
      QAction * _act_show_device;
      QAction * _act_show_mixer_bar;
      QAction * _act_show_vtype_bar;
      QActionGroup * _act_grp_menu_vtype;
      QAction * _act_alsa_cfg;
      QAction * _act_fullscreen;
      QAction * _act_fullscreen_tbar;

      // Key sequences
      QKeySequence _key_seq_device;
      QKeySequence _key_seq_mixer;
      QKeySequence _key_seq_vtype;


      // Context menu
      QPointer < QMenu > _context_menu;

      // System tray
      Mini_Mixer _mini_mixer;


      // State flags
      bool _setup_stage;
      bool _selecting_ctl;
      bool _is_minimized_in_tray;
      bool _silent_close;
      bool _force_close;
      bool _fully_closed;


      // Dialogs
      QPointer < Dialog_Settings > _dialog_settings;
      QPointer < QWidget > _dialog_info;
      QPointer < QWidget > _dialog_alsa_config;
};


inline
Mini_Mixer &
Main_Mixer_Window::mini_mixer ( )
{
      return _mini_mixer;
}


inline
const Mixer_Settings &
Main_Mixer_Window::settings ( ) const
{
      return _settings;
}


inline
bool
Main_Mixer_Window::setup_stage ( ) const
{
      return _setup_stage;
}


inline
unsigned int
Main_Mixer_Window::view_type ( ) const
{
      return _view_type;
}


inline
const QSnd::Snd_Control_Address &
Main_Mixer_Window::current_ctl ( ) const
{
      return _current_ctl;
}


inline
unsigned int
Main_Mixer_Window::num_view_types ( ) const
{
      return _num_view_types;
}


inline
bool
Main_Mixer_Window::is_minimized_in_tray ( ) const
{
      return _is_minimized_in_tray;
}


#endif

Generated by  Doxygen 1.6.0   Back to index