~ubuntu-branches/ubuntu/maverick/smplayer/maverick

« back to all changes in this revision

Viewing changes to src/assstyles.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-03-31 23:05:43 UTC
  • mfrom: (1.1.9 upstream) (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090331230543-1ned1omblgt4qiak
Tags: 0.6.7-1
* New upstream release. (Closes: #523791)
  - Reworked subtitle font preferences. (Closes: #503295)
  - No longer installs qt_fr.qm. (Closes: #486314)
* debian/control:
  - Bumped Standards-Version to 3.8.1.
  - Changed maintainer name (still the same person and GPG key).
  - Changed section to video.
  - Build-depend on zlib1g-dev for findsubtitles.
  - Require Qt >= 4.3 per readme.
  - Added ${misc:Depends}.
  - Make smplayer-translations depend on smplayer and smplayer recommend
    smplayer-translations, not the other way round. (Closes: #489375)
* debian/copyright:
  - Significantly expanded per-file with new upstream authors.
* debian/rules:
  - Make make use correct uic in install.
  - Clean svn_revision.
  - Removed get-orig-source - not needed with uscan --repack.
* debian/patches/01_gl_translation.patch:
  - Added patch to fix lrelease error on smplayer_gl.ts.
* Added debian/README.source for simple-patchsys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
3
3
 
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
27
27
        fontsize = 20;
28
28
        primarycolor = 0xFFFFFF;
29
29
        backcolor = 0;
 
30
        outlinecolor = 0;
30
31
        bold = false;
31
32
        italic = false;
32
33
        halignment = 2; // Centered
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;
95
98
                out << 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 << "," ;
116
120
        }
117
121
        return false;
118
122
}
 
123
 
 
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
 
130
        else
 
131
        if (valignment == 2) alignment += 4; // Top
 
132
 
 
133
        QString s = "PlayResX=512,PlayResY=320,"; // Aspect of 1.6, it doesn't look too bad either in 4:3 and 16:9
 
134
 
 
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);
 
142
 
 
143
        s += QString("Outline=%1,Shadow=%2,MarginL=%3,MarginR=%4,MarginV=%5")
 
144
                 .arg(outline).arg(shadow).arg(marginl).arg(marginr).arg(marginv);
 
145
 
 
146
 
 
147
        return s;
 
148
}