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
|
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include <QGridLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QIcon>
#include <QLabel>
#include <QSpacerItem>
#include <QPushButton>
#include "commonstrings.h"
#include "scribusdoc.h"
#include "page.h"
#include "colorcombo.h"
#include "prefsmanager.h"
#include "dcolor.h"
#include "util_icon.h"
DelColor::DelColor( QWidget* parent, ColorList colorList, QString colorName, bool haveDoc) : QDialog( parent )
{
setModal(true);
cList = colorList;
setWindowTitle( tr( "Delete Color" ) );
setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
dialogLayout = new QVBoxLayout( this );
dialogLayout->setMargin(10);
dialogLayout->setSpacing(5);
delColorLayout = new QGridLayout;
delColorLayout->setSpacing( 5 );
delColorLayout->setMargin( 5 );
deleteLabel = new QLabel( tr( "Delete Color:" ), this );
delColorLayout->addWidget( deleteLabel, 0, 0 );
colorToDelLabel = new QLabel( colorName, this );
delColorLayout->addWidget( colorToDelLabel, 0, 1 );
PrefsManager* prefsManager = PrefsManager::instance();
bool isToolColor = prefsManager->isToolColor(colorName);
if (haveDoc || isToolColor)
{
replaceLabel = new QLabel( tr( "Replace With:" ), this );
delColorLayout->addWidget( replaceLabel, 1, 0 );
replacementColData = new ColorCombo(false, this);
cList.remove(colorName);
// 10/26/2004 pv - user can replace deleted color with "None"
replacementColData->addItem(CommonStrings::tr_NoneColor);
replacementColData->insertItems(cList, ColorCombo::fancyPixmaps);
delColorLayout->addWidget( replacementColData, 1, 1 );
replacementColor = replacementColData->itemText(0);
}
dialogLayout->addLayout( delColorLayout );
okCancelLayout = new QHBoxLayout;
okCancelLayout->setSpacing( 5 );
okCancelLayout->setMargin( 0 );
QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
okCancelLayout->addItem( spacer );
okButton = new QPushButton( CommonStrings::tr_OK, this );
okCancelLayout->addWidget( okButton );
cancelButton = new QPushButton( CommonStrings::tr_Cancel, this );
cancelButton->setDefault( true );
okCancelLayout->addWidget( cancelButton );
dialogLayout->addLayout( okCancelLayout );
setMaximumSize(sizeHint());
connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
if (haveDoc || isToolColor)
connect( replacementColData, SIGNAL(activated(int)), this, SLOT( ReplaceColor(int) ) );
}
void DelColor::ReplaceColor(int id)
{
replacementColor = replacementColData->itemText(id);
}
const QString DelColor::getReplacementColor()
{
return replacementColor;
}
|