1
1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2008 Ricardo Villalba <rvm@escomposlinux.org>
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
4
4
This program is free software; you can redistribute it and/or modify
5
5
it under the terms of the GNU General Public License as published by
46
47
set->setValue("styles/fontsize", fontsize);
47
48
set->setValue("styles/primarycolor", primarycolor);
48
49
set->setValue("styles/backcolor", backcolor);
50
set->setValue("styles/outlinecolor", outlinecolor);
49
51
set->setValue("styles/bold", bold);
50
52
set->setValue("styles/italic", italic);
51
53
set->setValue("styles/halignment", halignment);
65
67
fontsize = set->value("styles/fontsize", fontsize).toInt();
66
68
primarycolor = set->value("styles/primarycolor", primarycolor).toInt();
67
69
backcolor = set->value("styles/backcolor", backcolor).toInt();
70
outlinecolor = set->value("styles/outlinecolor", outlinecolor).toInt();
68
71
bold = set->value("styles/bold", bold).toBool();
69
72
italic = set->value("styles/italic", italic).toBool();
70
73
halignment = set->value("styles/halignment", halignment).toInt();
71
74
valignment = set->value("styles/valignment", valignment).toInt();
72
75
borderstyle = set->value("styles/borderstyle", borderstyle).toInt();
73
outline = set->value("styles/outline", outline).toInt();
74
shadow = set->value("styles/shadow", shadow).toInt();
76
outline = set->value("styles/outline", outline).toDouble();
77
shadow = set->value("styles/shadow", shadow).toDouble();
75
78
marginl = set->value("styles/marginl", marginl).toInt();
76
79
marginr = set->value("styles/marginr", marginr).toInt();
77
80
marginv = set->value("styles/marginv", marginv).toInt();
94
97
out << "Collisions: Normal" << endl;
96
99
out << "[V4+ Styles]" << endl;
97
out << "Format: Name, Fontname, Fontsize, PrimaryColour, BackColour, Bold, Italic, Alignment, BorderStyle, Outline, Shadow, MarginL, MarginR, MarginV" << endl;
100
out << "Format: Name, Fontname, Fontsize, PrimaryColour, BackColour, OutlineColour, Bold, Italic, Alignment, BorderStyle, Outline, Shadow, MarginL, MarginR, MarginV" << endl;
98
101
out << "Style: Default,";
99
102
out << fontname << "," ;
100
103
out << fontsize << "," ;
101
104
out << "&H" << ColorUtils::colorToAABBGGRR(primarycolor) << "," ;
102
105
out << "&H" << ColorUtils::colorToAABBGGRR(backcolor) << "," ;
106
out << "&H" << ColorUtils::colorToAABBGGRR(outlinecolor) << "," ;
103
107
out << (bold ? -1 : 0) << "," ;
104
108
out << (italic ? -1 : 0) << "," ;
105
109
out << alignment << "," ;
124
// Returns a string for -ass-force-style
125
// It seems that option ignores "ScriptType: v4.00+"
126
// so the function uses the v4.00 format
127
QString AssStyles::toString() {
128
int alignment = halignment;
129
if (valignment == 1) alignment += 8; // Middle
131
if (valignment == 2) alignment += 4; // Top
133
QString s = "PlayResX=512,PlayResY=320,"; // Aspect of 1.6, it doesn't look too bad either in 4:3 and 16:9
135
s += QString("Name=Default,Fontname=%1,Fontsize=%2,PrimaryColour=&H%3,BackColour=&H%4,"
136
"OutlineColour=&H%5,Bold=%6,Italic=%7,Alignment=%8,BorderStyle=%9,")
137
.arg(fontname).arg(fontsize).arg(ColorUtils::colorToAABBGGRR(primarycolor))
138
.arg(ColorUtils::colorToAABBGGRR(backcolor))
139
.arg(ColorUtils::colorToAABBGGRR(outlinecolor))
140
.arg(bold ? 1 : 0).arg(italic ? 1 : 0)
141
.arg(alignment).arg(borderstyle);
143
s += QString("Outline=%1,Shadow=%2,MarginL=%3,MarginR=%4,MarginV=%5")
144
.arg(outline).arg(shadow).arg(marginl).arg(marginr).arg(marginv);