~mixxxdevelopers/mixxx/features_library_scanner

« back to all changes in this revision

Viewing changes to mixxx/mixxx/mixxxview.cpp

  • Committer: tuehaste
  • Date: 2002-02-26 11:12:07 UTC
  • Revision ID: vcs-imports@canonical.com-20020226111207-5rly26cj9gdd19ba
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          mixxxview.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Mon Feb 18 09:48:17 CET 2002
 
5
    copyright            : (C) 2002 by Tue and Ken Haste Andersen
 
6
    email                : 
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#include "mixxxview.h"
 
19
 
 
20
#include <qtable.h>
 
21
#include <qdir.h>
 
22
 
 
23
MixxxView::MixxxView(QWidget *parent, MixxxDoc *doc) : QWidget(parent)
 
24
{
 
25
        /** connect doc with the view*/
 
26
        connect(doc, SIGNAL(documentChanged()), this, SLOT(slotDocumentChanged()));
 
27
 
 
28
        // Sub widgets
 
29
        playcontrol = new DlgPlaycontrol(this);
 
30
        channel = new DlgChannel(this);
 
31
        playlist = new DlgPlaylist(this);
 
32
 
 
33
        // Layout management
 
34
        mainGrid = new QGridLayout(this,1,1); // A layout on a widget
 
35
        //hMainBox->setResizeMode(QLayout::Minimum);
 
36
        mainGrid->addWidget(channel,0,0);
 
37
        mainGrid->addWidget(playcontrol,0,1);
 
38
        mainGrid->addMultiCellWidget(playlist,1,1,0,1);
 
39
 
 
40
        //let the ratio between the widths of columns 0 and 1 be 2:3.
 
41
        mainGrid->setColStretch( 0, 150);
 
42
        mainGrid->setColStretch( 1, 310);
 
43
        mainGrid->setRowStretch( 0, 310);
 
44
        mainGrid->setRowStretch( 1, 210);
 
45
 
 
46
        // Add lines to table
 
47
        QDir d("music");
 
48
        d.setFilter(QDir::Files);
 
49
    if (!d.exists())
 
50
                qWarning( "Cannot find the ./music directory" );
 
51
    else {
 
52
 
 
53
                int i=0;
 
54
        const QFileInfoList *list = d.entryInfoList();
 
55
        QFileInfoListIterator it(*list);        // create list iterator
 
56
        QFileInfo *fi;                          // pointer for traversing
 
57
 
 
58
        while ((fi=it.current()) && (i<playlist->TableList->numRows())) {             // for each file...
 
59
                        playlist->TableList->setItem(i,0,new QTableItem(playlist->TableList,QTableItem::Never,
 
60
                                                                                                                        fi->baseName()));
 
61
            ++it;                               // goto next list element
 
62
                        i++;
 
63
        }
 
64
 
 
65
    }
 
66
}
 
67
 
 
68
MixxxView::~MixxxView()
 
69
{
 
70
}
 
71
 
 
72
void MixxxView::slotDocumentChanged()
 
73
{
 
74
  //TODO update the view
 
75
 
 
76
}