Exemple #1
0
ABMainWindow::ABMainWindow()
    : QMainWindow( 0, "example addressbook application" ),
      filename( QString::null )
{
    setupMenuBar();
    setupFileTools();
    setupStatusBar();
    setupCentralWidget();
}
SimpleUI::SimpleUI()
     : KMainWindow(0, "NoatunSimpleUI"), UserInterface()
{
    setAcceptDrops( true );
    setCaption( i18n("Noatun") );
    setIcon( SmallIcon( "noatun" ) );

    setupCentralWidget();
    setupActions();

    contextMenu = video->popupMenu( this );

    setupGUI( StatusBar|Create, "simpleui.rc" );

    connect( napp->player(), SIGNAL(playing()), SLOT(slotPlaying()) );
    connect( napp->player(), SIGNAL(stopped()), SLOT(slotStopped()) );
    connect( napp->player(), SIGNAL(paused()), SLOT(slotPaused()) );
    connect( napp->player(), SIGNAL(timeout()), SLOT(slotTimeout()) );
    connect( napp->player(), SIGNAL(newSong()), SLOT(slotChanged()) );
    connect( napp->player(), SIGNAL(volumeChanged(int)), SLOT(slotVolumeChanged(int)) );
    connect( napp, SIGNAL(hideYourself()), SLOT(hide()) );
    connect( napp, SIGNAL(showYourself()), SLOT(show()) );

    napp->player()->handleButtons();

    resize( minimumSize() );

    // Show UI and calculate video widget frame
    show();

    extra_width  = (width() - video->width());
    extra_height = (height() - video->height());

    // Load configuration
    KConfig &config = *KGlobal::config();
    config.setGroup( "Simple" );
    QString str = config.readEntry( "View", "NormalSize" );

    if (str == "HalfSize")
        video->setHalfSize();
    else if (str == "NormalSize")
        video->setNormalSize();
    else if (str == "DoubleSize")
        video->setDoubleSize();
    else
        applyMainWindowSettings( &config, "Simple" );

    // PlayObject could be running, update video widget
    slotChanged();

    video->give();
}
KUI_project::KUI_project(QWidget* parent): KMainWindow(parent)
{
  model = 0;
  
  trayIcon = new KSystemTrayIcon("media-playback-stop", 0 );
  connect(trayIcon, SIGNAL( activated(QSystemTrayIcon::ActivationReason)), 
          this, SLOT( unhideSlot() ) );
  
  path.append( QDir::homePath() );
  
  
  recArea.setCoords( 0, 0, 0, 0);
  setupConfig();
  
  this->resize( 700, 300 );
    
  collection = new KActionCollection(this);
  
  setupCentralWidget();
  
  menuBar = new KMenuBar;
  setupMenuFile();
  setupMenuWindow();
  setupMenuSettings();
  menuBar->addMenu(helpMenu());
  this->setMenuBar(menuBar);
  
  setupActions();
  
  KToolBar *tools = new KToolBar(i18n("&Tools"), this);
  tools->addAction(collection->action("new_file"));
  tools->addAction(collection->action("open_file"));
  tools->addAction(collection->action("add"));
  collection->action("add")->setEnabled( false );
  tools->addAction(collection->action("remove"));
  collection->action("remove")->setEnabled( false );
  //tools->addAction(collection->action("save_file"));
  tools->setToolButtonStyle(Qt::ToolButtonIconOnly);
 
  
  
  playBar = new MainToolBar( collection, this);
  
  playBar->setAccessibleDescription("Play Bar");
  
  this->addToolBar(Qt::BottomToolBarArea, playBar);
  connect( playBar->timeSlider, SIGNAL( sliderMoved(int) ),
	   this, SLOT( seekSlot(int) ) );
  
  
}