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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/***************************************************************************
* copyright : (C) 2006 Seb Ruiz <me@sebruiz.net> *
**************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "ipodheader.h"
#include "ipodexportdialog.h"
#include "klocale.h"
#include "kpushbutton.h"
#include "qlabel.h"
#include "qlayout.h"
using namespace IpodExport;
IpodHeader::IpodHeader( QWidget *parent, const char *name, WFlags f )
: QFrame( parent, name, f )
{
QVBoxLayout *layout = new QVBoxLayout( this, 10/*margin*/, 5/*spacing*/ );
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
m_messageLabel = new QLabel( QString::null, this );
m_messageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
QHBoxLayout *buttonLayout = new QHBoxLayout;
m_button = new KPushButton( this );
m_button->hide();
buttonLayout->addStretch( 1 );
buttonLayout->addWidget( m_button );
buttonLayout->addStretch( 1 );
layout->addWidget( m_messageLabel );
layout->addLayout( buttonLayout );
}
void IpodHeader::setViewType( ViewType view )
{
m_viewType = view;
switch( view )
{
case NoIpod:
setNoIpod();
break;
case IncompatibleIpod:
setIncompatibleIpod();
break;
case ValidIpod:
setValidIpod();
break;
default:
break;
}
}
void IpodHeader::setNoIpod()
{
m_messageLabel->setText( i18n("<p align=\"center\"><b>No iPod was detected</b></p>" ) );
setPaletteBackgroundColor( QColor(147,18,18) );
m_messageLabel->setPaletteBackgroundColor( QColor(147,18,18) );
m_messageLabel->setPaletteForegroundColor( Qt::white );
m_button->setText( i18n( "Refresh" ) );
m_button->show();
m_button->disconnect();
connect( m_button, SIGNAL( clicked() ), SIGNAL( refreshDevices() ) );
}
void IpodHeader::setIncompatibleIpod()
{
const QString modelType = UploadDialog::instance()->ipodModel();
m_messageLabel->setText( i18n("<p align=\"center\"><b>Your iPod (%1) does not seem to support artwork.</b></p>" ).arg( modelType ) );
setPaletteBackgroundColor( QColor(225,150,0) );
m_messageLabel->setPaletteBackgroundColor( QColor(225,150,0) );
m_messageLabel->setPaletteForegroundColor( Qt::white );
m_button->setText( i18n( "Set iPod Model" ) );
// m_button->show();
m_button->hide(); // FIXME its not implemented!
m_button->disconnect();
connect( m_button, SIGNAL( clicked() ), SIGNAL( updateSysInfo() ) );
}
void IpodHeader::setValidIpod()
{
const QString modelType = UploadDialog::instance()->ipodModel();
const QString mountPoint = UploadDialog::instance()->mountPoint();
if( !mountPoint.isEmpty() )
{
m_messageLabel->setText( i18n("<p align=\"center\"><b>iPod %1 detected at: %2</b></p>" )
.arg( modelType, mountPoint ) );
}
else
{
m_messageLabel->setText( i18n("<p align=\"center\"><b>iPod %1 detected</b></p>" )
.arg( modelType ) );
}
setPaletteBackgroundColor( QColor(0,98,0) );
m_messageLabel->setPaletteBackgroundColor( QColor(0,98,0) );
m_messageLabel->setPaletteForegroundColor( Qt::white );
m_button->hide();
}
|