summaryrefslogtreecommitdiffstats
path: root/src/k3bsidepanel.cpp
blob: 3ef831db9ad6f0badf0c7ce1176dbb74e6d6bb59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* 
 *
 * $Id: k3bsidepanel.cpp 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2004 Sebastian Trueg <trueg@k3b.org>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * See the file "COPYING" for the exact licensing terms.
 */

#include "k3bsidepanel.h"
#include "k3b.h"
#include "k3bfiletreeview.h"

#include <klocale.h>
#include <kiconloader.h>
#include <kdebug.h>

#include <tqtoolbutton.h>
#include <tqframe.h>
#include <tqlayout.h>



K3bSidePanel::K3bSidePanel( K3bMainWindow* m, TQWidget* parent, const char* name )
  : TQToolBox( parent, name ),
    m_mainWindow(m)
{
  // our first widget is the tree view
  m_fileTreeView = new K3bFileTreeView( this );
  addItem( m_fileTreeView, SmallIconSet( "folder_open" ), i18n("Folders") );

  // CD projects
  TQFrame* cdProjectsFrame = createPanel();
  addItem( cdProjectsFrame, SmallIconSet( "cdrom_unmount" ), i18n("CD Tasks") );
  addButton( cdProjectsFrame, m_mainWindow->action( "file_new_audio" ) );
  addButton( cdProjectsFrame, m_mainWindow->action( "file_new_data" ) );
  addButton( cdProjectsFrame, m_mainWindow->action( "file_new_mixed" ) );
  addButton( cdProjectsFrame, m_mainWindow->action( "file_new_vcd" ) );
  addButton( cdProjectsFrame, m_mainWindow->action( "file_new_movix" ) );
  TQGridLayout* grid = (TQGridLayout*)cdProjectsFrame->tqlayout();
  grid->setRowSpacing( grid->numRows(), 15 );
  addButton( cdProjectsFrame, m_mainWindow->action( "tools_copy_cd" ) );
  addButton( cdProjectsFrame, m_mainWindow->action( "tools_write_cd_image" ) );
  addButton( cdProjectsFrame, m_mainWindow->action( "tools_blank_cdrw" ) );
  grid->setRowStretch( grid->numRows()+1, 1 );

  // DVD projects
  TQFrame* dvdProjectsFrame = createPanel();
  addItem( dvdProjectsFrame, SmallIconSet( "dvd_unmount" ), i18n("DVD Tasks") );
  addButton( dvdProjectsFrame, m_mainWindow->action( "file_new_dvd" ) );
  addButton( dvdProjectsFrame, m_mainWindow->action( "file_new_video_dvd" ) );
  addButton( dvdProjectsFrame, m_mainWindow->action( "file_new_movix_dvd" ) );
  grid = (TQGridLayout*)dvdProjectsFrame->tqlayout();
  grid->setRowSpacing( grid->numRows(), 15 );
  addButton( dvdProjectsFrame, m_mainWindow->action( "tools_copy_dvd" ) );
  addButton( dvdProjectsFrame, m_mainWindow->action( "tools_write_dvd_iso" ) );
  addButton( dvdProjectsFrame, m_mainWindow->action( "tools_format_dvd" ) );
  grid->setRowStretch( grid->numRows()+1, 1 );


  // Tools
  // TODO sidepanel tools
}


K3bSidePanel::~K3bSidePanel()
{
}


TQFrame* K3bSidePanel::createPanel()
{
  TQFrame* frame = new TQFrame( this );
  frame->setPaletteBackgroundColor( TQt::white );
  TQGridLayout* grid = new TQGridLayout( frame );
  grid->setMargin( 5 );
  grid->setSpacing( 5 );
  return frame;
}


void K3bSidePanel::addButton( TQFrame* frame, KAction* a )
{
  if( a ) {
    TQToolButton* b = new TQToolButton( frame );
    b->setTextLabel( a->toolTip(), true );
    b->setTextLabel( a->text(), false );
    b->setIconSet( a->iconSet(KIcon::Small) );
    b->setUsesTextLabel( true );
    b->setAutoRaise( true );
    b->setTextPosition( TQToolButton::BesideIcon );

    connect( b, TQT_SIGNAL(clicked()), a, TQT_SLOT(activate()) );

    TQGridLayout* grid = (TQGridLayout*)(frame->tqlayout());
    grid->addWidget( b, grid->numRows(), 0 );
  }
  else
    kdDebug() << "(K3bSidePanel) null action." << endl;
}

#include "k3bsidepanel.moc"