Back to index

scribus-ng  1.3.4.dfsg+svn20071115
missing.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include <qimage.h>
00008 #include <qpixmap.h>
00009 #include <qlabel.h>
00010 #include <qlayout.h>
00011 #include <qpushbutton.h>
00012 
00013 #include "missing.h"
00014 #include "missing.moc"
00015 
00016 #include "fontcombo.h"
00017 #include "scribusdoc.h"
00018 #include "page.h"
00019 #include "prefsmanager.h"
00020 #include "commonstrings.h"
00021 
00022 extern QPixmap loadIcon(QString nam);
00023 
00024 static const char* const image100_data[] =
00025     {
00026         "32 32 243 2",
00027         ".# c None",
00028         "Qt c None",
00029         ".d c #000000",
00030         ".c c #000000",
00031         ".8 c #000000",
00032         ".t c #000000",
00033         "#p c #000000",
00034         ".J c #000000",
00035         "#K c #000000",
00036         "aR c #000000",
00037         ".i c #000000",
00038         "#7 c #000000",
00039         "#g c #000000",
00040         "bH c #000000",
00041         ".A c #000000",
00042         "#y c #000000",
00043         ".Q c #000000",
00044         "#z c #d54c00",
00045         "aH c #de5000",
00046         "#V c #000000",
00047         "a1 c #000000",
00048         ".7 c #000000",
00049         ".s c #000000",
00050         "bW c #000000",
00051         "bn c #000000",
00052         "#o c #000000",
00053         ".I c #000000",
00054         "bx c #000000",
00055         "bV c #000000",
00056         ".a c #cd4c00",
00057         ".b c #cd4800",
00058         "bG c #000000",
00059         "bO c #000000",
00060         "#J c #521c00",
00061         "aQ c #4a1c00",
00062         "bU c #000000",
00063         ".m c #7b2c00",
00064         ".W c #7b2c00",
00065         "#6 c #6a2800",
00066         "a2 c #d54c00",
00067         ".9 c #d55000",
00068         "bT c #5a2000",
00069         ".u c #d54c00",
00070         "bb c #9c3800",
00071         "#f c #943800",
00072         "#q c #d54c00",
00073         "bo c #d55000",
00074         "bP c #943400",
00075         "bQ c #833000",
00076         "bS c #833000",
00077         "bR c #8b3000",
00078         ".z c #9c3800",
00079         "ao c #a43c00",
00080         "bu c #ac3c00",
00081         "#x c #ac4000",
00082         ".e c #d54c00",
00083         ".h c #cd4c00",
00084         "#L c #d55000",
00085         "aG c #b44000",
00086         ".P c #bd4400",
00087         "bI c #cd4800",
00088         ".X c #d54c00",
00089         "#U c #bd4400",
00090         "bN c #b44400",
00091         ".6 c #bd4400",
00092         "a0 c #c54800",
00093         "#8 c #d54c00",
00094         "bc c #d55000",
00095         ".n c #de5000",
00096         ".r c #cd4800",
00097         "ag c #cd4c00",
00098         "bm c #c54800",
00099         "#h c #d54c00",
00100         "#n c #cd4c00",
00101         ".B c #d54c00",
00102         "ap c #d55000",
00103         "ay c #cd4c00",
00104         ".H c #d54c00",
00105         "#A c #d55000",
00106         "aI c #d54c00",
00107         ".R c #d55000",
00108         ".V c #d54c00",
00109         "aP c #d55000",
00110         "br c #181818",
00111         "bh c #181c18",
00112         "bg c #202020",
00113         "a7 c #292c29",
00114         "a6 c #313031",
00115         "bf c #313429",
00116         "aV c #393839",
00117         "a5 c #393c31",
00118         "aU c #414439",
00119         "bs c #737118",
00120         "ak c #737173",
00121         "ab c #7b797b",
00122         "aa c #837d83",
00123         "#Z c #838183",
00124         "#0 c #8b858b",
00125         "at c #8b896a",
00126         "aj c #8b897b",
00127         "#Q c #8b898b",
00128         "#F c #8b8d8b",
00129         "#P c #948d94",
00130         "#E c #949194",
00131         ".2 c #949594",
00132         "#b c #9c959c",
00133         "aW c #9c9941",
00134         ".3 c #9c999c",
00135         "#R c #a4a19c",
00136         "bq c #acaa18",
00137         "as c #acaa7b",
00138         "aT c #bdb652",
00139         "#1 c #bdba9c",
00140         "#O c #bdbaa4",
00141         ".4 c #c5c6bd",
00142         ".1 c #cdcabd",
00143         ".g c #d54c00",
00144         ".j c #d55000",
00145         "bM c #d55008",
00146         ".Y c #d55500",
00147         "bK c #d55508",
00148         "af c #d55900",
00149         "#Y c #d5d2ac",
00150         ".f c #de5000",
00151         "bJ c #de5008",
00152         ".o c #de5500",
00153         "bL c #de5508",
00154         ".q c #de5900",
00155         "#m c #de5d00",
00156         "#i c #de6100",
00157         ".G c #de6500",
00158         "aq c #de6d00",
00159         "#B c #de7100",
00160         "bw c #de7900",
00161         "#c c #dedacd",
00162         "#u c #dedebd",
00163         ".C c #e66900",
00164         "ax c #e66d00",
00165         "#I c #e67100",
00166         ".k c #e67900",
00167         ".S c #e67d00",
00168         "by c #e68500",
00169         "aO c #e68900",
00170         "#5 c #e68d00",
00171         "ac c #e6dea4",
00172         "bi c #e6e629",
00173         "a8 c #e6e639",
00174         "#k c #e6e6cd",
00175         ".l c #ee7d00",
00176         "#W c #ee8d00",
00177         "#e c #ee9100",
00178         ".y c #ee9900",
00179         "a3 c #eea100",
00180         "ah c #eeae00",
00181         "aB c #eeea7b",
00182         "#. c #f69108",
00183         ".v c #f69d00",
00184         "ba c #f6a500",
00185         ".K c #f6aa00",
00186         "#r c #f6ae00",
00187         "aF c #f6c600",
00188         "bp c #f6ca00",
00189         "bF c #f6d600",
00190         "bE c #f6d608",
00191         "bC c #f6d610",
00192         "a# c #f6eeac",
00193         "#t c #f6eecd",
00194         "#a c #f6f2de",
00195         "aA c #f6f67b",
00196         ".O c #ffae00",
00197         "#w c #ffae08",
00198         ".5 c #ffbe08",
00199         ".p c #ffc200",
00200         ".Z c #ffc210",
00201         ".w c #ffc600",
00202         ".x c #ffca00",
00203         "#T c #ffce08",
00204         "#M c #ffce10",
00205         "bz c #ffd600",
00206         "bA c #ffd608",
00207         "bD c #ffd610",
00208         ".D c #ffd631",
00209         "bB c #ffda10",
00210         "#j c #ffda20",
00211         "#l c #ffda29",
00212         "aS c #ffde00",
00213         "#9 c #ffde10",
00214         ".U c #ffde5a",
00215         "#H c #ffe231",
00216         ".T c #ffe25a",
00217         "#C c #ffe641",
00218         "aw c #ffea10",
00219         "## c #ffea7b",
00220         "bl c #ffee00",
00221         "bd c #ffee08",
00222         "ar c #ffee18",
00223         "#4 c #ffee41",
00224         "#X c #ffee52",
00225         "#d c #ffee83",
00226         "aJ c #fff220",
00227         "an c #fff241",
00228         "#v c #fff28b",
00229         ".N c #fff2ac",
00230         "aN c #fff618",
00231         "ai c #fff65a",
00232         "#s c #fff69c",
00233         ".L c #fff6ac",
00234         "b# c #fffa08",
00235         "a4 c #fffa18",
00236         "aZ c #fffa29",
00237         "aE c #fffa39",
00238         "az c #fffa52",
00239         "#N c #fffa9c",
00240         ".0 c #fffac5",
00241         "#G c #fffacd",
00242         "bv c #ffff00",
00243         "bt c #ffff08",
00244         "bk c #ffff10",
00245         "bj c #ffff18",
00246         "be c #ffff20",
00247         "b. c #ffff29",
00248         "a9 c #ffff31",
00249         "aY c #ffff39",
00250         "aX c #ffff41",
00251         "aM c #ffff4a",
00252         "aL c #ffff52",
00253         "aK c #ffff5a",
00254         "aD c #ffff62",
00255         "aC c #ffff6a",
00256         "av c #ffff73",
00257         "au c #ffff7b",
00258         "ae c #ffff83",
00259         "am c #ffff8b",
00260         "al c #ffff94",
00261         "a. c #ffff9c",
00262         "ad c #ffffa4",
00263         "#3 c #ffffac",
00264         "#2 c #ffffb4",
00265         "#S c #ffffbd",
00266         "#D c #ffffc5",
00267         ".F c #ffffcd",
00268         ".E c #ffffd5",
00269         ".M c #ffffe6",
00270         "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
00271         ".#.#.#.#.#.#.#.#.#.#.#.#.#.#.a.b.c.d.#.#.#.#.#.#.#.#.#.#.#.#.#.#",
00272         ".#.#.#.#.#.#.#.#.#.#.#.#.#.e.f.g.h.i.c.#.#.#.#.#.#.#.#.#.#.#.#.#",
00273         ".#.#.#.#.#.#.#.#.#.#.#.#.a.j.k.l.g.m.i.d.#.#.#.#.#.#.#.#.#.#.#.#",
00274         ".#.#.#.#.#.#.#.#.#.#.#.#.n.o.p.p.q.r.s.t.#.#.#.#.#.#.#.#.#.#.#.#",
00275         ".#.#.#.#.#.#.#.#.#.#.#.u.g.v.w.x.y.j.z.A.d.#.#.#.#.#.#.#.#.#.#.#",
00276         ".#.#.#.#.#.#.#.#.#.#.#.B.C.D.E.F.D.G.H.I.J.#.#.#.#.#.#.#.#.#.#.#",
00277         ".#.#.#.#.#.#.#.#.#.#.e.j.K.L.M.M.N.O.g.P.Q.c.#.#.#.#.#.#.#.#.#.#",
00278         ".#.#.#.#.#.#.#.#.#.a.R.S.T.M.M.M.M.U.l.V.W.i.d.#.#.#.#.#.#.#.#.#",
00279         ".#.#.#.#.#.#.#.#.#.X.Y.Z.0.1.2.3.4.0.5.q.6.7.8.#.#.#.#.#.#.#.#.#",
00280         ".#.#.#.#.#.#.#.#.9.g#.###a#b.3.3#b#c#d#e.f#f#g.d.#.#.#.#.#.#.#.#",
00281         ".#.#.#.#.#.#.#.##h#i#j.E#k.3.2.3.2.1.F#l#m#n#o#p.#.#.#.#.#.#.#.#",
00282         ".#.#.#.#.#.#.##q.f#r#s.E#t#b.3.2#b#u.E#v#w.g#x#y.c.#.#.#.#.#.#.#",
00283         ".#.#.#.#.#.##z#A#B#C#D.F.F.3#E#E#F#G#D#D#H#I.V#J#K.#.#.#.#.#.#.#",
00284         ".#.#.#.#.#.##L.g#M#N.F#D.F#O#P#Q#R#D#D#S#N#T.f#U#V.8.#.#.#.#.#.#",
00285         ".#.#.#.#.#.a.g#W#X#S#S#S#S#Y#Z#0#1#S#2#2#3#4#5.j#6#7.d.#.#.#.#.#",
00286         ".#.#.#.#.##8.q#9a.#2#2#2#2a#aaabac#3#3adadae#9afag.s.t.#.#.#.#.#",
00287         ".#.#.#.#.u.jahaiadadadadadadajaka.ada.alamalan#r.gao.A.d.#.#.#.#",
00288         ".#.#.#.#apaqarama.ala.ala.alasatalamamaeaeauavawaxay.I.J.#.#.#.#",
00289         ".#.#.#.e.g.wazaeaeaeaeaeaeaeaAaBauauavavaCaCaDaEaF.jaG.Q.c.#.#.#",
00290         ".#.#aHaI#WaJaCaCavavavavavaCavaCaCaDaDaKaKaLaLaMaNaOaPaQaR.#.#.#",
00291         ".#.#.X.qaSaMaLaKaKaDaKaKaKaTaUaVaWaLaMaMaXaXaYaYaZaSafa0a1.8.#.#",
00292         ".#a2.fa3a4aXaMaMaMaMaMaMaMa5a6a7a7a8aXaYaYa9a9b.b.b#ba.gbb#g.d.#",
00293         ".#bc#ibdbea9a9a9a9a9a9a9a9bfbgbgbhbibebebebebjbjbkbkbl.Gbmbn#p.#",
00294         "bo.gbpbkbebjbebebebebebebebqbhbrbsbjbjbkbjbkbkbtbkbtbtaF.fbu#y.c",
00295         ".B.Sbvbkbkbjbkbjbjbjbkbjbkbjbkbkbkbkbtbkbtbtbtbtbvbtbvbvbw.Hbx.J",
00296         ".fbybzbAbBbCbBbDbBbCbBbDbBbCbBbDbBbEbBbEbAbEbAbFbAbFbAbFaO.gbGbH",
00297         "bI.j.gbJ.jbKbKbLbKbLbKbLbKbKbKbL.jbM.jbJ.jbM.j.j.g.j.g.j.gbNbO#y",
00298         "aR.mbPbQbRbSbRbSbRbSbRbSbRbSbRbSbRbSbRbSbRbSbRbSbRbSbRbSbTbUbVaR",
00299         ".c.i#VbWbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbnbW#V.i.c",
00300         ".#.d.c.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.c.d.#",
00301         "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"
00302     };
00303 
00304 
00305 MissingFont::MissingFont( QWidget* parent, QString fon, ScribusDoc* doc )
00306               : QDialog( parent, "mfont", true, 0 )
00307 {
00308        QPixmap image0( ( const char** ) image100_data );
00309        setCaption( tr("Missing Font"));
00310        setIcon(loadIcon("AppIcon.png"));
00311        missingFontLayout = new QHBoxLayout( this, 10, 0 );
00312        missingFontGridLayout = new QGridLayout;
00313        missingFontGridLayout->setSpacing( 12 );
00314        missingFontGridLayout->setMargin( 0 );
00315        notInstalledLabel = new QLabel( tr("The Font %1 is not installed.").arg(fon), this, "notInstalledLabel" );
00316        missingFontGridLayout->addMultiCellWidget( notInstalledLabel, 0, 0, 1, 2 );
00317        pixmapLabel = new QLabel( this, "pixmapLabel" );
00318        pixmapLabel->setPixmap( image0 );
00319        missingFontGridLayout->addWidget( pixmapLabel, 1, 0 );
00320        useLabel = new QLabel( tr( "Use" ), this, "useLabel" );
00321        missingFontGridLayout->addWidget( useLabel, 1, 1 );
00322        replaceFontCombo = new FontCombo(this);
00323        if (doc != 0)
00324        {
00325               replaceFontCombo->setCurrentText(doc->toolSettings.defFont);
00326               replacementFont = doc->toolSettings.defFont;
00327        }
00328        else
00329        {
00330               replaceFontCombo->setCurrentText(PrefsManager::instance()->appPrefs.toolSettings.defFont);
00331               replacementFont = PrefsManager::instance()->appPrefs.toolSettings.defFont;
00332        }
00333        missingFontGridLayout->addWidget( replaceFontCombo, 1, 2 );
00334        insteadLabel = new QLabel( tr( "instead" ), this, "insteadLabel" );
00335        missingFontGridLayout->addWidget( insteadLabel, 1, 3 );
00336        okButton = new QPushButton( CommonStrings::tr_OK, this, "okButton" );
00337        missingFontGridLayout->addWidget( okButton, 2, 2 );
00338        missingFontLayout->addLayout( missingFontGridLayout );
00339 
00340        // signals and slots connections
00341        connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
00342        connect( replaceFontCombo, SIGNAL( activated(const QString&) ), this, SLOT( newFont(const QString&) ) );
00343 }
00344 
00345 void MissingFont::newFont(const QString& replacement)
00346 {
00347        replacementFont = replacement;
00348 }
00349 
00350 const QString MissingFont::getReplacementFont()
00351 {
00352        return replacementFont;
00353 }
00354