summaryrefslogtreecommitdiffstats
path: root/configdialog/kbfxconfigdlgfonts-old.ui.h
blob: 49f12fa25b16e5b0ed4531a6be2928de6b6b64e0 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** TQt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/

void KbfxConfigDlgFonts::init()
{
	KbfxFormReady = FALSE;
}

void KbfxConfigDlgFonts::ChangeForm()
{
	KbfxFormReady = FALSE;
	KbfxTheme->setText ( "<p align=left><b>" + ConfigInit().m_SpinxThemeName + "</b></p>" );
	KbfxBoldHover->setChecked ( ConfigInit().m_fontHoverBold );
	KbfxApplicationColor->setColor ( ConfigInit().m_fontAppNameColor );
	KbfxFont_app->setFont ( ConfigInit().m_fontAppNameFont );
	KbfxCommentColor->setColor ( ConfigInit().m_fontAppCommentColor );
	KbfxFont_comment->setFont ( ConfigInit().m_fontAppCommentFont );
	KbfxLineColor->setColor ( ConfigInit().m_lineColor );
	KbfxCategoryColor->setColor ( ConfigInit().m_fontIndexColor );
	KbfxFont_category->setFont ( ConfigInit().m_fontIndexFont );
	KbfxNameColor->setColor ( ConfigInit().m_userNameColor );
	KbfxFont_username->setFont ( ConfigInit().m_userNameFont );
	KbfxSeparatorColor->setColor ( ConfigInit().m_sepNameColor );
	KbfxFont_separator->setFont ( ConfigInit().m_sepNameFont );
	KbfxPluginColor->setColor ( ConfigInit().m_pluginNameColor );
	KbfxFont_plugin->setFont ( ConfigInit().m_pluginNameFont );
	KbfxTooltipColor->setColor ( ConfigInit().m_fontTooltipColor );
	KbfxFont_tooltip->setFont ( ConfigInit().m_fontTooltipFont );
	KbfxFormReady = TRUE;
}

void KbfxConfigDlgFonts::KbfxApplicationColorSelected ( const TQColor &color )
{
	ConfigInit().m_fontAppNameColor = color;

	kdDebug() << "Application color: "
	<< ConfigInit().m_fontAppNameColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxTooltipColorSelected ( const TQColor &color )
{
	ConfigInit().m_fontTooltipColor = color;

	kdDebug() << "Tooltip color: "
	<< ConfigInit().m_fontTooltipColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxCommentColorSelected ( const TQColor &color )
{
	ConfigInit().m_fontAppCommentColor = color;

	kdDebug() << "Comment color: "
	<< ConfigInit().m_fontAppCommentColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxLineColorSelected ( const TQColor & color )
{
	ConfigInit().m_lineColor = color;

	kdDebug() << "Line color: "
	<< ConfigInit().m_lineColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxCategoryColorSelected ( const TQColor &color )
{
	ConfigInit().m_fontIndexColor = color;

	kdDebug() << "Category color: "
	<< ConfigInit().m_fontIndexColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxNameColorSelected ( const TQColor &color )
{
	ConfigInit().m_userNameColor = color;

	kdDebug() << "User color: "
	<< ConfigInit().m_userNameColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxSeparatorColorSelected ( const TQColor &color )
{
	ConfigInit().m_sepNameColor = color;

	kdDebug() << "Separator color: "
	<< ConfigInit().m_sepNameColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxPluginColorSelected( const TQColor &color )
{
	ConfigInit().m_pluginNameColor = color;

	kdDebug() << "Plugin color: "
	<< ConfigInit().m_pluginNameColor
	<< endl;
}

void KbfxConfigDlgFonts::KbfxExportFileAction()
{
	/*
	  KFileDialog KbfxExportFontRcDialog(TQString(),
	                                     "*.*|" + tr2i18n("All files"),
	                                     0,
	                                     0,
	                                     TRUE);
	  KbfxExportFontRcDialog.setOperationMode(KFileDialog::Saving);
	  KbfxExportFontRcDialog.setCaption(tr2i18n("Select Folder to export kbfxfontrc file"));
	  KbfxExportFontRcDialog.setMode(KFile::Directory);

	  if(!KbfxExportFontRcDialog.exec()) return;

	  TQString KbfxExportFontRcDialogURL = KbfxExportFontRcDialog.selectedURL().path();
	*/

	TQString KbfxExportFontRcDialogURL = KFileDialog::getExistingDirectory (
	                                        TQString(),
	                                        0,
	                                        tr2i18n ( "Select folder to export kbfxfontrc file" ) ).append ( "/kbfxfontrc" );

	if ( KbfxExportFontRcDialogURL == "/kbfxfontrc") return;

	kdDebug() << "Selected export file is: "
	<< KbfxExportFontRcDialogURL
	<< endl;

	KConfig *fontconfig = new KConfig ( KbfxExportFontRcDialogURL );

	fontconfig->setGroup ( "Fonts" );
	fontconfig->writeEntry ( "TooltipText", ConfigInit().m_fontTooltipColor );
	fontconfig->writeEntry ( "TooltipTextFont", ConfigInit().m_fontTooltipFont );
	fontconfig->writeEntry ( "ApplicationText", ConfigInit().m_fontAppNameColor );
	fontconfig->writeEntry ( "ApplicationTextFont", ConfigInit().m_fontAppNameFont );
	fontconfig->writeEntry ( "CommentText", ConfigInit().m_fontAppCommentColor );
	fontconfig->writeEntry ( "CommentTextFont", ConfigInit().m_fontAppCommentFont );
	fontconfig->writeEntry ( "GroupText", ConfigInit().m_fontIndexColor );
	fontconfig->writeEntry ( "GroupTextFont", ConfigInit().m_fontIndexFont );
	fontconfig->writeEntry ( "UserName", ConfigInit().m_userNameColor );
	fontconfig->writeEntry ( "UserNameFont", ConfigInit().m_userNameFont );
	fontconfig->writeEntry ( "SeparatorColor", ConfigInit().m_sepNameColor );
	fontconfig->writeEntry ( "SeparatorFont", ConfigInit().m_sepNameFont );
	fontconfig->writeEntry ( "PluginColor", ConfigInit().m_pluginNameColor );
	fontconfig->writeEntry ( "PluginFont", ConfigInit().m_pluginNameFont );
	fontconfig->writeEntry ( "LineColor", ConfigInit().m_lineColor );
	fontconfig->writeEntry ( "HoverBold", ConfigInit().m_fontHoverBold );
	fontconfig->sync();

	delete fontconfig;
	KMessageBox::information ( 0,
	                           tr2i18n ( "<p align='center'>The Font configuration of the KBFX Theme <strong>%1</strong> has been exported successfully!</p>" ).arg ( ConfigInit().m_SpinxThemeName ),
	                           tr2i18n ( "KBFX Font Export Ready" ) );
}


void KbfxConfigDlgFonts::FontChanged()
{
	if (KbfxFormReady)
	{
		ConfigInit().m_fontAppNameFont = KbfxFont_app->font();
		ConfigInit().m_fontAppCommentFont = KbfxFont_comment->font();
		ConfigInit().m_fontIndexFont = KbfxFont_category->font();
		ConfigInit().m_userNameFont = KbfxFont_username->font();
		ConfigInit().m_sepNameFont = KbfxFont_separator->font();
		ConfigInit().m_pluginNameFont = KbfxFont_plugin->font();
		ConfigInit().m_fontTooltipFont = KbfxFont_tooltip->font();

		/*
		kdDebug() << "Changed font... "
		<< endl  << ConfigInit().m_fontAppNameFont
		<< endl  << ConfigInit().m_fontAppCommentFont
		<< endl  << ConfigInit().m_fontIndexFont
		<< endl  << ConfigInit().m_userNameFont
		<< endl  << ConfigInit().m_sepNameFont
		<< endl  << ConfigInit().m_pluginNameFont
		<< endl  << ConfigInit().m_fontTooltipFont
		<< endl;
		*/
	}
}


void KbfxConfigDlgFonts::KbfxBoldHover_toggled( bool state )
{
	ConfigInit().m_fontHoverBold = state;
	kdDebug() << "Bold on hover is: "
	<< endl  << ConfigInit().m_fontHoverBold
	<< endl;
}