forked from SoftProjector/softprojector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
biblesettingwidget.cpp
656 lines (559 loc) · 21.6 KB
/
biblesettingwidget.cpp
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
/***************************************************************************
//
// softProjector - an open source media projection software
// Copyright (C) 2017 Vladislav Kobzar
//
// 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 version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
***************************************************************************/
#include "biblesettingwidget.hpp"
#include "ui_biblesettingwidget.h"
BibleSettingWidget::BibleSettingWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::BibleSettingWidget)
{
ui->setupUi(this);
}
BibleSettingWidget::~BibleSettingWidget()
{
delete ui;
}
void BibleSettingWidget::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch ( e->type() ) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void BibleSettingWidget::setSettings(BibleSettings &settings, BibleSettings &settings2)
{
mySettings = settings;
mySettings2 = settings2;
loadSettings();
}
void BibleSettingWidget::getSettings(BibleSettings &settings, BibleSettings &settings2)
{
// Effects
mySettings.useShadow = ui->checkBoxUseShadow->isChecked();
mySettings.useFading = ui->checkBoxUseFading->isChecked();
mySettings.useBlurShadow = ui->checkBoxUseBlurredShadow->isChecked();
mySettings2.useShadow = ui->checkBoxUseShadow2->isChecked();
mySettings2.useFading = ui->checkBoxUseFading2->isChecked();
mySettings2.useBlurShadow = ui->checkBoxUseBlurredShadow2->isChecked();
// Backgroud
mySettings.useBackground = ui->groupBoxBackground->isChecked();
mySettings.backgroundName = ui->lineEditBackPath->text();
mySettings2.useBackground = ui->groupBoxBackground2->isChecked();
mySettings2.backgroundName = ui->lineEditBackPath2->text();
//Alignment
mySettings.textAlignmentV = ui->comboBoxVerticalAling->currentIndex();
mySettings.textAlignmentH = ui->comboBoxHorizontalAling->currentIndex();
mySettings2.textAlignmentV = ui->comboBoxVerticalAling2->currentIndex();
mySettings2.textAlignmentH = ui->comboBoxHorizontalAling2->currentIndex();
//Caption Alignment
mySettings.captionPosition = ui->comboBoxCaptionPosition->currentIndex();
mySettings.captionAlignment = ui->comboBoxCaptionAlign->currentIndex();
mySettings2.captionPosition = ui->comboBoxCaptionPosition2->currentIndex();
mySettings2.captionAlignment = ui->comboBoxCaptionAlign2->currentIndex();
// Version Abbreviations
mySettings.useAbbriviation = ui->checkBoxAbbiviations->isChecked();
mySettings2.useAbbriviation = ui->checkBoxAbbiviations2->isChecked();
// Max screen use
mySettings.screenUse = ui->spinBoxMaxScreen->value();
mySettings.screenPosition = ui->comboBoxScreenPosition->currentIndex();
mySettings2.screenUse = ui->spinBoxMaxScreen2->value();
mySettings2.screenPosition = ui->comboBoxScreenPosition2->currentIndex();
// Get if to use secodary screen settings
mySettings2.useDisp2settings = ui->groupBoxUseDisp2->isChecked();
settings = mySettings;
settings2 = mySettings2;
}
void BibleSettingWidget::setBibleVersions(BibleVersionSettings &bver, BibleVersionSettings &bver2)
{
bversion = bver;
bversion2 = bver2;
loadBibleVersions();
}
void BibleSettingWidget::getBibleVersions(BibleVersionSettings &bver, BibleVersionSettings &bver2)
{
int pbx = ui->comboBoxPrimaryBible->currentIndex();
int sbx = ui->comboBoxSecondaryBible->currentIndex();
int tbx = ui->comboBoxTrinaryBible->currentIndex();
int obx = ui->comboBoxOperatorBible->currentIndex();
// Get Bible version settings
if(pbx != -1)
{
// Primary
bversion.primaryBible = bible_id_list.at(pbx);
// Secondary
if(sbx <=0)
bversion.secondaryBible = "none";
else
bversion.secondaryBible = secondary_id_list.at(sbx-1);
// Trinary
if(tbx <=0)
bversion.trinaryBible = "none";
else
bversion.trinaryBible = trinary_id_list.at(tbx-1);
// Operatror
if(obx <=0)
bversion.operatorBible = "same";
else
bversion.operatorBible = operator_id_list.at(obx-1);
}
else
{
// There are no bibles in the database
bversion.primaryBible = "none";
bversion.secondaryBible = "none";
bversion.trinaryBible = "none";
bversion.operatorBible = "same";
}
// Get Bible versions for secondary screen
pbx = ui->comboBoxPrimaryBible2->currentIndex();
sbx = ui->comboBoxSecondaryBible2->currentIndex();
tbx = ui->comboBoxTrinaryBible2->currentIndex();
if(pbx != -1)
{
// Primary
bversion2.primaryBible = bible_id_list.at(pbx);
// Secondary
if(sbx <=0)
bversion2.secondaryBible = "none";
else
bversion2.secondaryBible = secondary_id_list2.at(sbx-1);
// Trinary
if(tbx <=0)
bversion2.trinaryBible = "none";
else
bversion2.trinaryBible = trinary_id_list2.at(tbx-1);
}
else
{
// There are no bibles in the database
bversion2.primaryBible = "none";
bversion2.secondaryBible = "none";
bversion2.trinaryBible = "none";
bversion2.operatorBible = "same";
}
bver = bversion;
bver2 = bversion2;
}
void BibleSettingWidget::loadSettings()
{
// Set Effects
ui->checkBoxUseShadow->setChecked(mySettings.useShadow);
ui->checkBoxUseFading->setChecked(mySettings.useFading);
ui->checkBoxUseBlurredShadow->setChecked(mySettings.useBlurShadow);
ui->checkBoxUseShadow2->setChecked(mySettings2.useShadow);
ui->checkBoxUseFading2->setChecked(mySettings2.useFading);
ui->checkBoxUseBlurredShadow2->setChecked(mySettings2.useBlurShadow);
// Set background use
ui->groupBoxBackground->setChecked(mySettings.useBackground);
ui->lineEditBackPath->setText(mySettings.backgroundName);
ui->groupBoxBackground2->setChecked(mySettings2.useBackground);
ui->lineEditBackPath2->setText(mySettings2.backgroundName);
// Set text color
QPalette p;
p.setColor(QPalette::Base,mySettings.textColor);
ui->graphicViewTextColor->setPalette(p);
p.setColor(QPalette::Base,mySettings2.textColor);
ui->graphicViewTextColor2->setPalette(p);
// Set text font
ui->labelFont->setText(getFontText(mySettings.textFont));
ui->labelFont2->setText(getFontText(mySettings2.textFont));
// Set alignment
ui->comboBoxVerticalAling->setCurrentIndex(mySettings.textAlignmentV);
ui->comboBoxHorizontalAling->setCurrentIndex(mySettings.textAlignmentH);
ui->comboBoxVerticalAling2->setCurrentIndex(mySettings2.textAlignmentV);
ui->comboBoxHorizontalAling2->setCurrentIndex(mySettings2.textAlignmentH);
// Set caption color
p.setColor(QPalette::Base,mySettings.captionColor);
ui->graphicViewCaptionColor->setPalette(p);
p.setColor(QPalette::Base,mySettings2.captionColor);
ui->graphicViewCaptionColor2->setPalette(p);
// Set caption font
ui->labelFontCaption->setText(getFontText(mySettings.captionFont));
ui->labelFontCaption2->setText(getFontText(mySettings2.captionFont));
// Set caption alignment
ui->comboBoxCaptionPosition->setCurrentIndex(mySettings.captionPosition);
ui->comboBoxCaptionPosition2->setCurrentIndex(mySettings2.captionPosition);
ui->comboBoxCaptionAlign->setCurrentIndex(mySettings.captionAlignment);
ui->comboBoxCaptionAlign2->setCurrentIndex(mySettings2.captionAlignment);
// Set abbriviations use
ui->checkBoxAbbiviations->setChecked(mySettings.useAbbriviation);
ui->checkBoxAbbiviations2->setChecked(mySettings2.useAbbriviation);
// Set max screen use
ui->spinBoxMaxScreen->setValue(mySettings.screenUse);
ui->comboBoxScreenPosition->setCurrentIndex(mySettings.screenPosition);
ui->spinBoxMaxScreen2->setValue(mySettings2.screenUse);
ui->comboBoxScreenPosition2->setCurrentIndex(mySettings2.screenPosition);
// Set if to use secondary screen settings
ui->groupBoxUseDisp2->setChecked(mySettings2.useDisp2settings);
on_groupBoxUseDisp2_toggled(mySettings2.useDisp2settings);
}
void BibleSettingWidget::loadBibleVersions()
{
// Clear items if exitst
bibles.clear();
bible_id_list.clear();
// Get Bibles that exist in the database
QSqlQuery sq;
sq.exec("SELECT bible_name, id FROM BibleVersions");
while(sq.next())
{
bibles << sq.value(0).toString();
bible_id_list << sq.value(1).toString();
}
sq.clear();
// Fill bibles comboboxes
ui->comboBoxPrimaryBible->clear();
ui->comboBoxPrimaryBible->addItems(bibles);
ui->comboBoxSecondaryBible->clear();
ui->comboBoxSecondaryBible->addItem(tr("None"));
ui->comboBoxSecondaryBible->addItems(bibles);
ui->comboBoxTrinaryBible->clear();
ui->comboBoxTrinaryBible->addItem(tr("None"));
ui->comboBoxTrinaryBible->addItems(bibles);
ui->comboBoxOperatorBible->clear();
ui->comboBoxOperatorBible->addItem(tr("Same as primary Bible"));
ui->comboBoxOperatorBible->addItems(bibles);
ui->comboBoxPrimaryBible2->clear();
ui->comboBoxPrimaryBible2->addItems(bibles);
ui->comboBoxSecondaryBible2->clear();
ui->comboBoxSecondaryBible2->addItem(tr("None"));
ui->comboBoxSecondaryBible2->addItems(bibles);
ui->comboBoxTrinaryBible2->clear();
ui->comboBoxTrinaryBible2->addItem(tr("None"));
ui->comboBoxTrinaryBible2->addItems(bibles);
// Set current primary bible
if(bversion.primaryBible == "none")
ui->comboBoxPrimaryBible->setCurrentIndex(0);
else
ui->comboBoxPrimaryBible->setCurrentIndex(bible_id_list.indexOf(bversion.primaryBible));
if(bversion2.primaryBible == "none")
ui->comboBoxPrimaryBible2->setCurrentIndex(0);
else
ui->comboBoxPrimaryBible2->setCurrentIndex(bible_id_list.indexOf(bversion2.primaryBible));
// Set current secondary bible
if(bversion.secondaryBible == "none")
ui->comboBoxSecondaryBible->setCurrentIndex(0);
else
ui->comboBoxSecondaryBible->setCurrentIndex(bible_id_list.indexOf(bversion.secondaryBible)+1);
if(bversion2.secondaryBible == "none")
ui->comboBoxSecondaryBible2->setCurrentIndex(0);
else
ui->comboBoxSecondaryBible2->setCurrentIndex(bible_id_list.indexOf(bversion2.secondaryBible)+1);
// Set current trinaty bibile
if(bversion.trinaryBible == "none")
ui->comboBoxTrinaryBible->setCurrentIndex(0);
else
ui->comboBoxTrinaryBible->setCurrentIndex(bible_id_list.indexOf(bversion.trinaryBible)+1);
updateSecondaryBibleMenu();
if(bversion2.trinaryBible == "none")
ui->comboBoxTrinaryBible2->setCurrentIndex(0);
else
ui->comboBoxTrinaryBible2->setCurrentIndex(bible_id_list.indexOf(bversion2.trinaryBible)+1);
updateSecondaryBibleMenu2();
// Set current operator bibile
if(bversion.operatorBible == "same")
ui->comboBoxOperatorBible->setCurrentIndex(0);
else
ui->comboBoxOperatorBible->setCurrentIndex(bible_id_list.indexOf(bversion.operatorBible)+1);
updateOperatorBibleMenu();
}
void BibleSettingWidget::updateSecondaryBibleMenu()
{
QString pbible = ui->comboBoxPrimaryBible->currentText();
QString sbible = ui->comboBoxSecondaryBible->currentText();
secondary_bibles = bibles;
secondary_bibles.removeOne(pbible);
secondary_id_list = bible_id_list;
secondary_id_list.removeAt(ui->comboBoxPrimaryBible->currentIndex());
ui->comboBoxSecondaryBible->clear();
ui->comboBoxSecondaryBible->addItem(tr("None"));
ui->comboBoxSecondaryBible->addItems(secondary_bibles);
int i = ui->comboBoxSecondaryBible->findText(sbible);
if( i != -1 )
// The same secondary bible is still available
ui->comboBoxSecondaryBible->setCurrentIndex(i);
updateTrinaryBibleMenu();
}
void BibleSettingWidget::updateSecondaryBibleMenu2()
{
QString pbible = ui->comboBoxPrimaryBible2->currentText();
QString sbible = ui->comboBoxSecondaryBible2->currentText();
secondary_bibles2 = bibles;
secondary_bibles2.removeOne(pbible);
secondary_id_list2 = bible_id_list;
secondary_id_list2.removeAt(ui->comboBoxPrimaryBible2->currentIndex());
ui->comboBoxSecondaryBible2->clear();
ui->comboBoxSecondaryBible2->addItem(tr("None"));
ui->comboBoxSecondaryBible2->addItems(secondary_bibles2);
int i = ui->comboBoxSecondaryBible2->findText(sbible);
if( i != -1 ) // The same secondary bible is still available
ui->comboBoxSecondaryBible2->setCurrentIndex(i);
updateTrinaryBibleMenu2();
}
void BibleSettingWidget::updateTrinaryBibleMenu()
{
if (ui->comboBoxSecondaryBible->currentIndex() == 0)
{
ui->comboBoxTrinaryBible->setCurrentIndex(0);
ui->comboBoxTrinaryBible->setEnabled(false);
}
else
{
ui->comboBoxTrinaryBible->setEnabled(true);
QString sbible = ui->comboBoxSecondaryBible->currentText();
QString tbible = ui->comboBoxTrinaryBible->currentText();
QStringList trinary_bibles = secondary_bibles;
trinary_bibles.removeOne(sbible);
trinary_id_list = secondary_id_list;
trinary_id_list.removeAt(ui->comboBoxSecondaryBible->currentIndex()-1);
ui->comboBoxTrinaryBible->clear();
ui->comboBoxTrinaryBible->addItem(tr("None"));
ui->comboBoxTrinaryBible->addItems(trinary_bibles);
int i = ui->comboBoxTrinaryBible->findText(tbible);
if( i != -1 )
// The same secondary bible is still available
ui->comboBoxTrinaryBible->setCurrentIndex(i);
}
}
void BibleSettingWidget::updateTrinaryBibleMenu2()
{
if (ui->comboBoxSecondaryBible2->currentIndex() == 0)
{
ui->comboBoxTrinaryBible2->setCurrentIndex(0);
ui->comboBoxTrinaryBible2->setEnabled(false);
}
else
{
ui->comboBoxTrinaryBible2->setEnabled(true);
QString sbible = ui->comboBoxSecondaryBible2->currentText();
QString tbible = ui->comboBoxTrinaryBible2->currentText();
QStringList trinary_bibles = secondary_bibles2;
trinary_bibles.removeOne(sbible);
trinary_id_list2 = secondary_id_list2;
trinary_id_list2.removeAt(ui->comboBoxSecondaryBible2->currentIndex()-1);
ui->comboBoxTrinaryBible2->clear();
ui->comboBoxTrinaryBible2->addItem(tr("None"));
ui->comboBoxTrinaryBible2->addItems(trinary_bibles);
int i = ui->comboBoxTrinaryBible2->findText(tbible);
if( i != -1 )
// The same secondary bible is still available
ui->comboBoxTrinaryBible2->setCurrentIndex(i);
}
}
void BibleSettingWidget::updateOperatorBibleMenu()
{
QString pbible = ui->comboBoxPrimaryBible->currentText();
QString obible = ui->comboBoxOperatorBible->currentText();
QStringList operator_bibles = bibles;
operator_bibles.removeOne(pbible);
operator_id_list = bible_id_list;
operator_id_list.removeAt(ui->comboBoxPrimaryBible->currentIndex());
ui->comboBoxOperatorBible->clear();
ui->comboBoxOperatorBible->addItem(tr("Same as primary Bible"));
ui->comboBoxOperatorBible->addItems(operator_bibles);
int i = ui->comboBoxOperatorBible->findText(obible);
if( i != -1 )
// The same operaotr bible is still available
ui->comboBoxOperatorBible->setCurrentIndex(i);
}
void BibleSettingWidget::setDispScreen2Visible(bool visible)
{
ui->groupBoxUseDisp2->setVisible(visible);
}
void BibleSettingWidget::on_comboBoxPrimaryBible_activated(const QString &arg1)
{
updateSecondaryBibleMenu();
updateOperatorBibleMenu();
}
void BibleSettingWidget::on_comboBoxPrimaryBible2_activated(const QString &arg1)
{
updateSecondaryBibleMenu2();
updateTrinaryBibleMenu2();
}
void BibleSettingWidget::on_comboBoxSecondaryBible_activated(const QString &arg1)
{
updateTrinaryBibleMenu();
}
void BibleSettingWidget::on_comboBoxSecondaryBible2_activated(const QString &arg1)
{
updateTrinaryBibleMenu2();
}
void BibleSettingWidget::on_checkBoxUseShadow_stateChanged(int arg1)
{
if(arg1==2)
ui->checkBoxUseBlurredShadow->setEnabled(true);
else
{
ui->checkBoxUseBlurredShadow->setChecked(false);
ui->checkBoxUseBlurredShadow->setEnabled(false);
}
}
void BibleSettingWidget::on_checkBoxUseShadow2_stateChanged(int arg1)
{
if(arg1==2)
ui->checkBoxUseBlurredShadow2->setEnabled(true);
else
{
ui->checkBoxUseBlurredShadow2->setChecked(false);
ui->checkBoxUseBlurredShadow2->setEnabled(false);
}
}
void BibleSettingWidget::on_buttonBrowseBackground_clicked()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Select a image for Bible wallpaper"),
".", tr("Images(%1)").arg(getSupportedImageFormats()));
if(!filename.isNull())
{
QPixmap p(filename);
mySettings.backgroundPix = p;
QFileInfo fi(filename);
filename = fi.fileName();
mySettings.backgroundName = filename;
ui->lineEditBackPath->setText(filename);
}
}
void BibleSettingWidget::on_buttonBrowseBackground2_clicked()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Select a image for Bible wallpaper"),
".", tr("Images(%1)").arg(getSupportedImageFormats()));
if(!filename.isNull())
{
QPixmap p(filename);
mySettings2.backgroundPix = p;
QFileInfo fi(filename);
filename = fi.fileName();
mySettings2.backgroundName = filename;
ui->lineEditBackPath2->setText(filename);
}
}
void BibleSettingWidget::on_toolButtonTextColor_clicked()
{
QColor c(QColorDialog::getColor(mySettings.textColor,this));
if(c.isValid())
mySettings.textColor = c;
QPalette p;
p.setColor(QPalette::Base,mySettings.textColor);
ui->graphicViewTextColor->setPalette(p);
}
void BibleSettingWidget::on_toolButtonTextColor2_clicked()
{
QColor c(QColorDialog::getColor(mySettings2.textColor,this));
if(c.isValid())
mySettings2.textColor = c;
QPalette p;
p.setColor(QPalette::Base,mySettings2.textColor);
ui->graphicViewTextColor2->setPalette(p);
}
void BibleSettingWidget::on_toolButtonTextFont_clicked()
{
bool ok;
QFont font = QFontDialog::getFont(&ok,mySettings.textFont,this);
if(ok)
mySettings.textFont = font;
ui->labelFont->setText(getFontText(mySettings.textFont));
}
void BibleSettingWidget::on_toolButtonTextFont2_clicked()
{
bool ok;
QFont font = QFontDialog::getFont(&ok,mySettings2.textFont,this);
if(ok)
mySettings2.textFont = font;
ui->labelFont2->setText(getFontText(mySettings2.textFont));
}
void BibleSettingWidget::on_toolButtonCaptionColor_clicked()
{
QColor c(QColorDialog::getColor(mySettings.captionColor,this));
if(c.isValid())
mySettings.captionColor = c;
QPalette p;
p.setColor(QPalette::Base,mySettings.captionColor);
ui->graphicViewCaptionColor->setPalette(p);
}
void BibleSettingWidget::on_toolButtonCaptionColor2_clicked()
{
QColor c(QColorDialog::getColor(mySettings2.captionColor,this));
if(c.isValid())
mySettings2.captionColor = c;
QPalette p;
p.setColor(QPalette::Base,mySettings2.captionColor);
ui->graphicViewCaptionColor2->setPalette(p);
}
void BibleSettingWidget::on_toolButtonCaptionFont_clicked()
{
bool ok;
QFont font = QFontDialog::getFont(&ok,mySettings.captionFont,this);
if(ok)
mySettings.captionFont = font;
ui->labelFontCaption->setText(getFontText(mySettings.captionFont));
}
void BibleSettingWidget::on_toolButtonCaptionFont2_clicked()
{
bool ok;
QFont font = QFontDialog::getFont(&ok,mySettings2.captionFont,this);
if(ok)
mySettings2.captionFont = font;
ui->labelFontCaption2->setText(getFontText(mySettings2.captionFont));
}
void BibleSettingWidget::on_groupBoxUseDisp2_toggled(bool arg1)
{
ui->widgetBibles2->setVisible(arg1);
ui->groupBoxEffects2->setVisible(arg1);
ui->groupBoxBackground2->setVisible(arg1);
ui->groupBoxMaxScreen2->setVisible(arg1);
ui->groupBoxCaptionProperties2->setVisible(arg1);
ui->groupBoxTextProperties2->setVisible(arg1);
ui->checkBoxAbbiviations2->setVisible(arg1);
}
void BibleSettingWidget::on_pushButtonDefault_clicked()
{
BibleSettings b;
mySettings = b;
mySettings2 = b;
loadSettings();
}
QString BibleSettingWidget::getFontText(QFont font)
{
QString f = font.toString().split(",").at(0);
QString st(QString("%1: %2").arg(f).arg(font.pointSize()));
if(font.bold())
st += ", " + tr("Bold");
if(font.italic())
st += ", " + tr("Italic");
if(font.strikeOut())
st += ", " + tr("StrikeOut");
if(font.underline())
st += ", " + tr("Underline");
return st;
}
void BibleSettingWidget::on_pushButtonApplyToAll_clicked()
{
emit applyBackToAll(1,mySettings.backgroundName,mySettings.backgroundPix);
}
void BibleSettingWidget::setBackgroungds(QString name, QPixmap back)
{
mySettings.backgroundName = name;
mySettings.backgroundPix = back;
mySettings2.backgroundName = name;
mySettings2.backgroundPix = back;
ui->lineEditBackPath->setText(name);
ui->lineEditBackPath2->setText(name);
}