From aa7d2c54d3f2b7b9d610f6f654247fef27fb28d6 Mon Sep 17 00:00:00 2001
From: Denis Mingulov <denis.mingulov@symbio.com>
Date: Fri, 18 Jun 2010 11:02:48 +0200
Subject: [PATCH] ImageViewer: Reimplemented as a new plugin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Merge-request: 2165
Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
---
 .../imageviewer/ImageViewer.mimetypes.xml     |  70 ++++++
 .../imageviewer/ImageViewer.pluginspec        |  19 ++
 src/plugins/imageviewer/images/background.png | Bin 0 -> 1050 bytes
 .../imageviewer/images/fitinscreen.png        | Bin 0 -> 737 bytes
 .../imageviewer/images/originalsize.png       | Bin 0 -> 593 bytes
 src/plugins/imageviewer/images/outline.png    | Bin 0 -> 593 bytes
 src/plugins/imageviewer/images/zoomin.png     | Bin 0 -> 541 bytes
 src/plugins/imageviewer/images/zoomout.png    | Bin 0 -> 258 bytes
 src/plugins/imageviewer/imageview.cpp         | 221 ++++++++++++++++++
 src/plugins/imageviewer/imageview.h           |  92 ++++++++
 src/plugins/imageviewer/imageviewer.cpp       | 194 +++++++++++++++
 src/plugins/imageviewer/imageviewer.h         |  85 +++++++
 src/plugins/imageviewer/imageviewer.pro       |  31 +++
 src/plugins/imageviewer/imageviewer.qrc       |  11 +
 .../imageviewer/imageviewer_dependencies.pri  |   3 +
 .../imageviewer/imageviewerconstants.h        |  43 ++++
 .../imageviewer/imageviewerfactory.cpp        |  96 ++++++++
 src/plugins/imageviewer/imageviewerfactory.h  |  65 ++++++
 src/plugins/imageviewer/imageviewerfile.cpp   | 145 ++++++++++++
 src/plugins/imageviewer/imageviewerfile.h     |  74 ++++++
 src/plugins/imageviewer/imageviewerplugin.cpp |  78 +++++++
 src/plugins/imageviewer/imageviewerplugin.h   |  60 +++++
 src/plugins/imageviewer/imageviewertoolbar.ui | 143 ++++++++++++
 src/plugins/plugins.pro                       |   4 +
 24 files changed, 1434 insertions(+)
 create mode 100644 src/plugins/imageviewer/ImageViewer.mimetypes.xml
 create mode 100644 src/plugins/imageviewer/ImageViewer.pluginspec
 create mode 100644 src/plugins/imageviewer/images/background.png
 create mode 100644 src/plugins/imageviewer/images/fitinscreen.png
 create mode 100644 src/plugins/imageviewer/images/originalsize.png
 create mode 100644 src/plugins/imageviewer/images/outline.png
 create mode 100644 src/plugins/imageviewer/images/zoomin.png
 create mode 100644 src/plugins/imageviewer/images/zoomout.png
 create mode 100644 src/plugins/imageviewer/imageview.cpp
 create mode 100644 src/plugins/imageviewer/imageview.h
 create mode 100644 src/plugins/imageviewer/imageviewer.cpp
 create mode 100644 src/plugins/imageviewer/imageviewer.h
 create mode 100644 src/plugins/imageviewer/imageviewer.pro
 create mode 100644 src/plugins/imageviewer/imageviewer.qrc
 create mode 100644 src/plugins/imageviewer/imageviewer_dependencies.pri
 create mode 100644 src/plugins/imageviewer/imageviewerconstants.h
 create mode 100644 src/plugins/imageviewer/imageviewerfactory.cpp
 create mode 100644 src/plugins/imageviewer/imageviewerfactory.h
 create mode 100644 src/plugins/imageviewer/imageviewerfile.cpp
 create mode 100644 src/plugins/imageviewer/imageviewerfile.h
 create mode 100644 src/plugins/imageviewer/imageviewerplugin.cpp
 create mode 100644 src/plugins/imageviewer/imageviewerplugin.h
 create mode 100644 src/plugins/imageviewer/imageviewertoolbar.ui

diff --git a/src/plugins/imageviewer/ImageViewer.mimetypes.xml b/src/plugins/imageviewer/ImageViewer.mimetypes.xml
new file mode 100644
index 00000000000..f4f99a7a1cf
--- /dev/null
+++ b/src/plugins/imageviewer/ImageViewer.mimetypes.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+    <mime-type type="image/bmp">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>BMP image</comment>
+        <glob pattern="*.bmp"/>
+    </mime-type>
+    <mime-type type="image/gif">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>GIF image</comment>
+        <glob pattern="*.gif"/>
+    </mime-type>
+    <mime-type type="image/x-icon">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>ICO image</comment>
+        <glob pattern="*.ico"/>
+    </mime-type>
+    <mime-type type="image/jpeg">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>JPEG image</comment>
+        <glob pattern="*.jpg"/>
+        <glob pattern="*.jpeg"/>
+    </mime-type>
+    <mime-type type="video/x-mng">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>MNG video</comment>
+        <glob pattern="*.mng"/>
+    </mime-type>
+    <mime-type type="image/x-portable-bitmap">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>PBM image</comment>
+        <glob pattern="*.pbm"/>
+    </mime-type>
+    <mime-type type="image/x-portable-graymap">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>PGM image</comment>
+        <glob pattern="*.pgm"/>
+    </mime-type>
+    <mime-type type="image/png">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>PNG image</comment>
+        <glob pattern="*.png"/>
+    </mime-type>
+    <mime-type type="image/x-portable-pixmap">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>PPM image</comment>
+        <glob pattern="*.ppm"/>
+    </mime-type>
+    <mime-type type="image/svg+xml">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>SVG image</comment>
+        <glob pattern="*.svg"/>
+    </mime-type>
+    <mime-type type="image/tiff">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>TIFF image</comment>
+        <glob pattern="*.tif"/>
+        <glob pattern="*.tiff"/>
+    </mime-type>
+    <mime-type type="image/xbm">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>XBM image</comment>
+        <glob pattern="*.xbm"/>
+    </mime-type>
+    <mime-type type="image/xpm">
+        <sub-class-of type="application/octet-stream"/>
+        <comment>XPM image</comment>
+        <glob pattern="*.xpm"/>
+    </mime-type>
+</mime-info>
diff --git a/src/plugins/imageviewer/ImageViewer.pluginspec b/src/plugins/imageviewer/ImageViewer.pluginspec
new file mode 100644
index 00000000000..6659fa854ec
--- /dev/null
+++ b/src/plugins/imageviewer/ImageViewer.pluginspec
@@ -0,0 +1,19 @@
+<plugin name="ImageViewer" version="2.1.80" compatVersion="2.1.80">
+    <vendor>Nokia Corporation</vendor>
+    <copyright>(C) 2010 Denis Mingulov</copyright>
+    <license>
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
+
+GNU Lesser General Public License Usage
+
+Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.  Please review the following information to ensure the GNU Lesser General Public License version 2.1 requirements will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+    </license>
+    <category>Qt Creator</category>
+    <description>Image Viewer component.</description>
+    <url>http://qt.nokia.com</url>
+    <dependencyList>
+        <dependency name="Core" version="2.1.80"/>
+    </dependencyList>
+</plugin>
diff --git a/src/plugins/imageviewer/images/background.png b/src/plugins/imageviewer/images/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..93a092ab13dfecfe099db859a6f56bcbed44a92a
GIT binary patch
literal 1050
zcmV+#1m*jQP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F80000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU#yh%hsRCwCFS37GPK@gr@J?sR6EJz`n
z5Db<{nOfN3I;9(v(p3V6K-%;P1iR2*&<{wJ+Th-#O&}&|1qL^65<PBbva>t8w|6={
zQdlR3)va_p-+bT9?4IiP`)>f?+*%9Pd)-@mS7+zFUa!?|x7X_Z?(VL2eSLk-09spH
zTX1!C1vfW0FdmN|)N!-fg#G<}I66Aw+eZulh{!pgynGGyCr_cKH7IL@2!_oVFj)o}
z+jI)kZ0bk0iHy^HF3Wh#{4<6}1Bk}?*-#mbzW;#3!$Sus0^rE?<2ERzoO5jr?QhEd
zrqU1;-zBE1Bb_r1W2ys^azG;hM07VKU^sG~;nCfvD-eZ$dZTJbv_y*FGco|;5S7Qy
zk@GzN(ajTs5kRTQ2hw};5NHuV@mXMiwGKb35ToP(8uaD>F)(stG%5iJBneYQ3m8ZN
z@FE&@{zvkTT_U0fzzK!nyD)>403iV)j)`VPsRm%PmdGZb(g{@pz%h||Af^NYDawRM
zGcr}_Pziv`jHBmDaM_;Z0Vd^`0}*Kij8EFY2$n#skOK@rY2^V(7LZWOPK*&2GUKfR
zL}WystI~fi0Ip440RWMr_MQb3SwLfQSz?kVY~cS$U;)f$Adw+jA_b;NTFix|eIRAP
z0SFzAq?#E3$-)K;k!K|kj)jm1D5bd!K&bx$fY{MOd7(&Q^0F*gE<wt`yes%D0B{n7
z3P@V7%Y)FOV=g2);heJs#cEj8kShW3F6ZJ;0L1nxGDHy48zLit{uQF10gxskM_-m8
z?*~DO#7yZvM!(us%7M&p$3+E7oh|8nvHJyPXl3Ws3~(b-em7T9!LYG}T)=$GPLeb1
zl&fAdRnTZOpfUObBh{>sK&pZAz7QPddaveuLmAMDW;@~b_BQl}za0w?dDUt)*x7j&
z6P*Fv+xl;HyIt7Z+gr<tn4Qa!>@Nd&I~)!_+OfOl_kv&6J}7tk37O}uCd@QgGCoPm
zcb=~e27{lARy{pEeZi`7PIF;dn<U0_CO>|X&w+{qtxkXhFg)smgM(#}H3UG&WE7`5
z36ctZ0Op^p%cd_cFTa%zzvUCSmU&(A{H&8X5;TPR%|wFw+1c4E`&QFm6u!-;&leXL
z1Bp6NKNicxq6E6)C{GD(QNxpyljpWdKFu7<OV;Uh-X9+ycf{dD*2rW{EWb9?E8Zta
zoX4)o3+(Rhe!0E9eY`?;Z(5eVN>ycvnPh!f1OQ9-wGyCJuaP`wlIUml=zjtX0Bx{~
U()J@iBme*a07*qoM6N<$f}&N?)c^nh

literal 0
HcmV?d00001

diff --git a/src/plugins/imageviewer/images/fitinscreen.png b/src/plugins/imageviewer/images/fitinscreen.png
new file mode 100644
index 0000000000000000000000000000000000000000..cbe2f31521a0ae72eb5cbedde285372e5bd5affd
GIT binary patch
literal 737
zcmV<70v`Q|P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt007q5
z)K6G40000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!b4f%&RCwBq
zQ%h(QQ53yzGB3XplQb!brH#^9Yt)JuYF8p|gepiEf~!h5A|klx&V^LLg*$OAb*F+@
zKZxkADhO#+w4V`7Q*CS7e6T;$OftzN<GnKzHKBqJ4)4vo@0@$yy>FPNX|UB`j0rf^
zz|3trTqPinW)Qa|w?#!bH#Pvw(hnBis|%D1??GO90S^c7K`Ad|f-;I!Sfc}-eDdZs
zd$a3QWTz*0u-&<X_CI{hCBH1Lxs|2)F?cX=9aLo<x%oN)RArcX(C+sP_4jV)djh<R
z3x@l0RRbwmia(7luu^>DE<C$*8@bCugL@0vKCsJ^JJfFL@;8al;xa(%o(}u&NT_)O
z+-=A4tbeN-2z2Ko;cXR<!vZdw0CsNVD3+^WRTv!G?`xfud`{eQ*9qwMjcPN8RnW<9
z6meP&0l8#cg<_y-^kE0HMfC%#{bufG(#f+r*})Can%unlyqbp1OyZB_T7!*hYSbzz
zz7$kfZ>a*L>a=6?rP+^(tQS&~@90*#^S`@rrOz>20j7NFJl`?yKD`p%7fPRrwzN|0
z{&+V1b|&R5O0gMuJ~RSa^&4`hehUnraKuFsI^}`}Ss51YI4?heK=)y2@<;SLlWofU
z`o>EnleHwZQ7__fpCiFJgo8m2sdO2NYZb3;;;N*m@W_0=cGD!;-az~?XAp^OwL&-$
z;E>6bLHe%dN2k?MwE}sJQ>IM>ua(#oDVS>z1rf4}qJ@b(y{O7aevD))(iCFZJowL_
ziH7guQJZwOhp&qk7{Tugh`k6K)yJ$6s};Nv6tE&fh;H*?Nr*WND)1lUmjD9*{Wl*o
TfcKyf00000NkvXXu0mjf)!9re

literal 0
HcmV?d00001

diff --git a/src/plugins/imageviewer/images/originalsize.png b/src/plugins/imageviewer/images/originalsize.png
new file mode 100644
index 0000000000000000000000000000000000000000..133378a8e7dd3a82296c0fd4b2093efce0e26972
GIT binary patch
literal 593
zcmV-X0<QguP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz^GQTORCwCNle>#rQ4q$zYZOHBtsoXY
zVibv>5j!g_w$?ykvDhMzW()tAG#dyhQU!}tsf09wg`$Opa(%D_R}_UPzVQ(snK_tX
zYKsi~IL9+H-<|t;u5>z`a7`$1WhfJg#O3cd#69tfFcXi&?7V&_z7aqF5xCgj+ibQ6
zuh$EM!2p#?h1F{HV!z+>8Xb*Bx5MEOyWQ?R)qWsa+$6>0anbB@xgOkZH=4~RCX)#l
zLZ{O~tyaTqHpAg?h<&%)6*Y&$;Vt!jW&w{zqxlhyMo}ylp-?Emdye^hE`+AjDVED6
z^m;u4fdDs)T3Vm8iMOm?sZ>ByAd|^JtJOlORKn?W!eX(Y*XxN~Fc?IkP{3lbfZy*I
zle2)#2Of_HsZ>flx!><&yWJw6&m))1!DKR_TrMLLi6EU$V=x%7FI@V_0%abNlk4?b
zP%4#Buh+q*Ns=T)`Mz+D4NfMLJn=6&{>TEuMx#+}x7*lkHiB?CjPZC3yWK9}eJB+A
zo3B=@n9XLQ=NX%HJRY01TJ4VBS79_7h2#8MolZxX=kxgxi^YU_JXtoIJ<x;ih$o4Q
z&v8S1B6FN<7CUaWT1A5HfcQsbSw^eX>eA7>^TooYz@K=1R(BFF&u22hjbDhbm&MY5
f|Cp{8_$|Ny%(UruplqZ}00000NkvXXu0mjfSX>d9

literal 0
HcmV?d00001

diff --git a/src/plugins/imageviewer/images/outline.png b/src/plugins/imageviewer/images/outline.png
new file mode 100644
index 0000000000000000000000000000000000000000..aaa9464535529bb3cef7e3eede71e3e76fd4dea5
GIT binary patch
literal 593
zcmV-X0<QguP)<h;3K|Lk000e1NJLTq000;O000;W1^@s6;CDUv0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz^GQTORCwC7md$FyKoo^<Og7zEcM29<
zDEb(JP$(_dO}p>`6kNLKQ@C{D19T^DTA`b+f`vYXh$tc=NEiP9HD~b3Bqp_Knt`K}
z%=n#q?<6w@_WM2gsQ~%hl+@D|rN3@(jDE?`ogvjDb8G0`P))yldsT|X;(ag}e930B
zluRZm5b&1NZnvX$yG_kzlO~hNBWR^uE=Q?UiWEihTyroIi3EWOwq|^!W3iYR>~uQR
zXf$Xv8kwT9LJ%di*=%UNUJKzm91c^VP!Pd_sj6xQ8C)10F`-_so8U4G+HSW3x>~Jh
zHk%18mrHRE>h*e5tyaZcG)>b;V-VVSJU$ySfH0Dc*&N^fe*ef5CcH2|fze+q7ROT9
zfvwjj1KeaID;Q(*`P>m?cg?($40w`kf;wA&>^cLh0h=IlE{mHC91XCD96i8x3wrL_
z)_`j!Po7Svu1aGaJIMfVATq!pBL8h^WXWsCPo>EKPyp~q!t5_#?mK3H=<%lh73^q$
z77B%^+wC4p<rWM@A`z1T_M#P+BcIO;6O@Yg7g;dn{fPVWy90Q+TsG}n$Uq+q2G`MO
zl;ZI?RVo$Frx?tJ!y$}5kU_20YKcwCsU&U%xUTE)s_~Kea5yqE|8x|89*)dsMc!Kd
fXukie_!eLQOnD6hQV0jN00000NkvXXu0mjf)KUVU

literal 0
HcmV?d00001

diff --git a/src/plugins/imageviewer/images/zoomin.png b/src/plugins/imageviewer/images/zoomin.png
new file mode 100644
index 0000000000000000000000000000000000000000..be8c961df1ea263370d0515634dd6461562b9a4c
GIT binary patch
literal 541
zcmV+&0^<FNP)<h;3K|Lk000e1NJLTq000&M000&U1^@s6#I$TX00009a7bBm000XU
z000XU0RWnu7ytkO2XskIMF-Ub4-XqM`&p2k00006VoOIv0RI600RN!9r;`8x0jfzv
zK~y-)#g)HG13?hR6S!QHXGj}T_zqTrM6ebtV=(CieE<s)6e9jf5D5}Ah<}1XG=i8y
z1YbZq3oQgu6a-5V8TZ?piFe0dyt_gdK9+;o-_6c9yPHV-!$>MoA7zx%92aR=05mU%
z8fQfH(=R<QZr%uZgyB|Ha0&no?R--0@LkX2GhG1}l(HNbY1jZDQ$UxR_q4YEMEQv$
z0Z%IBIPUMkNv>6jWwS9J@bb<B4Hw%2E-MXiob6g`xeX0;zj02q-gdy1?K>*ZUQ)<z
zalmf(MSwz*F~AG;YpQJBQvKxPC(hh04%qF!2$^DD-Fwzx5lT{Pz4qb)y2SyzYZ+Am
zrg}3*5QMC-bw~g!yN^^oc+oqMIH=lsqkQq$3`UKx9sC)B`!EVM6)>Pv^H(%l>h$8Y
z6m)QG!we1*j6(JRBU3<s=?YJcGwf!8{|J?I?Unm5%23NWrD=|nH3ffHr1>Mu+sJYA
z_d9uj4so2U$@=>^)XDRKL!G?9yTaWq0q)1Uggo71cHfS5ABS*173T#pb&KD9E6$r|
f>K4EIMx(v~ByA9VCqq<J00000NkvXXu0mjf2F>4f

literal 0
HcmV?d00001

diff --git a/src/plugins/imageviewer/images/zoomout.png b/src/plugins/imageviewer/images/zoomout.png
new file mode 100644
index 0000000000000000000000000000000000000000..4466844662e19b4e91d994941b3d09ac56ec087e
GIT binary patch
literal 258
zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4foCO|{#S9GG!XV7ZFl&wkP>{XE
z)7O>#Dl<R7l&t6EIjuk;wj^(N7l!{JxM1({$v}~QPZ!4!i_^&o60D0E#1mMO#1zt6
zlgx|^eDt}m*cklqchzA(a;KnK{Qdv`_1~`TPkDSyb9o}$Z%5vC37$!BqHFqd-b~%Z
zm{!0hkbU9M0~v*DOQs%-Drk00WSOKQZtZ^l_`4*nq$vi|nvbPf38Xvcs*0vNe_gzU
xD^J6n`4z9O(FU~;doQbHk>{jYodp;ez9d<`{kL_-OQ6#jJYD@<);T3K0RSGWRoegn

literal 0
HcmV?d00001

diff --git a/src/plugins/imageviewer/imageview.cpp b/src/plugins/imageviewer/imageview.cpp
new file mode 100644
index 00000000000..ce602e6f71a
--- /dev/null
+++ b/src/plugins/imageviewer/imageview.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "imageview.h"
+
+#include <QtCore/QFile>
+#include <QtGui/QWheelEvent>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QGraphicsRectItem>
+#include <QtGui/QPixmap>
+#include <QtSvg/QGraphicsSvgItem>
+#include <QtGui/QImageReader>
+#include <qmath.h>
+
+
+namespace ImageViewer {
+namespace Constants {
+    const qreal DEFAULT_SCALE_FACTOR = 1.2;
+}
+
+namespace Internal {
+
+struct ImageViewPrivate
+{
+    ImageViewPrivate() : imageItem(0), backgroundItem(0), outlineItem(0) {}
+    QGraphicsItem *imageItem;
+    QGraphicsRectItem *backgroundItem;
+    QGraphicsRectItem *outlineItem;
+};
+
+ImageView::ImageView(QWidget *parent)
+    : QGraphicsView(parent),
+    d_ptr(new ImageViewPrivate())
+{
+    setScene(new QGraphicsScene(this));
+    setTransformationAnchor(AnchorUnderMouse);
+    setDragMode(ScrollHandDrag);
+    setViewportUpdateMode(FullViewportUpdate);
+
+    // Prepare background check-board pattern
+    QPixmap tilePixmap(64, 64);
+    tilePixmap.fill(Qt::white);
+    QPainter tilePainter(&tilePixmap);
+    QColor color(220, 220, 220);
+    tilePainter.fillRect(0, 0, 0x20, 0x20, color);
+    tilePainter.fillRect(0x20, 0x20, 0x20, 0x20, color);
+    tilePainter.end();
+
+    setBackgroundBrush(tilePixmap);
+}
+
+ImageView::~ImageView()
+{
+
+}
+
+void ImageView::drawBackground(QPainter *p, const QRectF &)
+{
+    p->save();
+    p->resetTransform();
+    p->drawTiledPixmap(viewport()->rect(), backgroundBrush().texture());
+    p->restore();
+}
+
+bool ImageView::openFile(QString fileName)
+{
+    bool isSvg = false;
+    QByteArray format = QImageReader::imageFormat(fileName);
+
+    // if it is impossible to recognize a file format - file will not be open correctly
+    if (format.isEmpty())
+        return false;
+
+    if (format.startsWith("svg"))
+        isSvg = true;
+
+    QGraphicsScene *s = scene();
+
+    bool drawBackground = (d_ptr->backgroundItem ? d_ptr->backgroundItem->isVisible() : false);
+    bool drawOutline = (d_ptr->outlineItem ? d_ptr->outlineItem->isVisible() : true);
+
+    s->clear();
+    resetTransform();
+
+    // image
+    if (isSvg) {
+        d_ptr->imageItem = new QGraphicsSvgItem(fileName);
+    } else {
+        QPixmap pixmap(fileName);
+        d_ptr->imageItem = new QGraphicsPixmapItem(pixmap);
+    }
+    d_ptr->imageItem->setFlags(QGraphicsItem::ItemClipsToShape);
+    d_ptr->imageItem->setCacheMode(QGraphicsItem::NoCache);
+    d_ptr->imageItem->setZValue(0);
+
+    // background item
+    d_ptr->backgroundItem = new QGraphicsRectItem(d_ptr->imageItem->boundingRect());
+    d_ptr->backgroundItem->setBrush(Qt::white);
+    d_ptr->backgroundItem->setPen(Qt::NoPen);
+    d_ptr->backgroundItem->setVisible(drawBackground);
+    d_ptr->backgroundItem->setZValue(-1);
+
+    // outline
+    d_ptr->outlineItem = new QGraphicsRectItem(d_ptr->imageItem->boundingRect());
+    QPen outline(Qt::black, 2, Qt::DashLine);
+    outline.setCosmetic(true);
+    d_ptr->outlineItem->setPen(outline);
+    d_ptr->outlineItem->setBrush(Qt::NoBrush);
+    d_ptr->outlineItem->setVisible(drawOutline);
+    d_ptr->outlineItem->setZValue(1);
+
+    s->addItem(d_ptr->backgroundItem);
+    s->addItem(d_ptr->imageItem);
+    s->addItem(d_ptr->outlineItem);
+
+    // if image size is 0x0, then it is not loaded
+    if (d_ptr->imageItem->boundingRect().height() == 0 && d_ptr->imageItem->boundingRect().width() == 0)
+        return false;
+    emitScaleFactor();
+
+    return true;
+}
+
+void ImageView::setViewBackground(bool enable)
+{
+    if (!d_ptr->backgroundItem)
+          return;
+
+    d_ptr->backgroundItem->setVisible(enable);
+}
+
+void ImageView::setViewOutline(bool enable)
+{
+    if (!d_ptr->outlineItem)
+        return;
+
+    d_ptr->outlineItem->setVisible(enable);
+}
+
+void ImageView::doScale(qreal factor)
+{
+    scale(factor, factor);
+    emitScaleFactor();
+}
+
+void ImageView::wheelEvent(QWheelEvent *event)
+{
+    qreal factor = qPow(Constants::DEFAULT_SCALE_FACTOR, event->delta() / 240.0);
+    doScale(factor);
+    event->accept();
+}
+
+void ImageView::zoomIn()
+{
+    doScale(Constants::DEFAULT_SCALE_FACTOR);
+}
+
+void ImageView::zoomOut()
+{
+    doScale(1. / Constants::DEFAULT_SCALE_FACTOR);
+}
+
+void ImageView::resetToOriginalSize()
+{
+    resetTransform();
+    emitScaleFactor();
+}
+
+void ImageView::fitToScreen()
+{
+    fitInView(d_ptr->imageItem, Qt::KeepAspectRatio);
+    emitScaleFactor();
+}
+
+void ImageView::emitScaleFactor()
+{
+    // get scale factor directly from the transform matrix
+    qreal factor = transform().m11();
+    emit scaleFactorChanged(factor);
+}
+
+} // namespace Internal
+} // namespace ImageView
diff --git a/src/plugins/imageviewer/imageview.h b/src/plugins/imageviewer/imageview.h
new file mode 100644
index 00000000000..253ab36a8df
--- /dev/null
+++ b/src/plugins/imageviewer/imageview.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of Qt Creator.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef IMAGEVIEW_H
+#define IMAGEVIEW_H
+
+#include <QtGui/QGraphicsView>
+#include <QtCore/QScopedPointer>
+
+QT_BEGIN_NAMESPACE
+class QWheelEvent;
+QT_END_NAMESPACE
+
+namespace ImageViewer {
+namespace Internal {
+
+class ImageView : public QGraphicsView
+{
+    Q_OBJECT
+
+public:
+    ImageView(QWidget *parent = 0);
+    ~ImageView();
+
+    bool openFile(QString fileName);
+
+signals:
+    void scaleFactorChanged(qreal factor);
+
+public slots:
+    void setViewBackground(bool enable);
+    void setViewOutline(bool enable);
+    void zoomIn();
+    void zoomOut();
+    void resetToOriginalSize();
+    void fitToScreen();
+
+private slots:
+    void emitScaleFactor();
+    void doScale(qreal factor);
+
+protected:
+    void drawBackground(QPainter *p, const QRectF &rect);
+    void wheelEvent(QWheelEvent *event);
+
+private:
+    QScopedPointer<struct ImageViewPrivate> d_ptr;
+};
+
+} // namespace Internal
+} // namespace ImageViewer
+
+#endif // IMAGEVIEW_H
diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp
new file mode 100644
index 00000000000..c44b941295d
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewer.cpp
@@ -0,0 +1,194 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "imageviewer.h"
+#include "imageviewerfile.h"
+#include "imageviewerconstants.h"
+#include "imageview.h"
+#include "ui_imageviewertoolbar.h"
+
+#include <coreplugin/icore.h>
+#include <coreplugin/uniqueidmanager.h>
+
+#include <QtCore/QMap>
+#include <QtCore/QFileInfo>
+#include <QtGui/QWidget>
+#include <QtCore/QtDebug>
+
+namespace ImageViewer {
+namespace Internal {
+
+struct ImageViewerPrivate
+{
+    QList<int> context;
+    QString displayName;
+    ImageViewerFile *file;
+    ImageView *imageView;
+    QWidget *toolbar;
+    Ui::ImageViewerToolbar ui_toolbar;
+};
+
+ImageViewer::ImageViewer(QWidget *parent)
+    : IEditor(parent),
+    d_ptr(new ImageViewerPrivate)
+{
+    d_ptr->file = new ImageViewerFile(this);
+    d_ptr->context << Core::ICore::instance()->uniqueIDManager()
+            ->uniqueIdentifier(Constants::IMAGEVIEWER_ID);
+
+    d_ptr->imageView = new ImageView();
+
+    // toolbar
+    d_ptr->toolbar = new QWidget();
+    d_ptr->ui_toolbar.setupUi(d_ptr->toolbar);
+
+    // connections
+    connect(d_ptr->file, SIGNAL(changed()), this, SIGNAL(changed()));
+
+    connect(d_ptr->ui_toolbar.toolButtonZoomIn, SIGNAL(clicked()),
+            d_ptr->imageView, SLOT(zoomIn()));
+    connect(d_ptr->ui_toolbar.toolButtonZoomOut, SIGNAL(clicked()),
+            d_ptr->imageView, SLOT(zoomOut()));
+    connect(d_ptr->ui_toolbar.toolButtonFitToScreen, SIGNAL(clicked()),
+            d_ptr->imageView, SLOT(fitToScreen()));
+    connect(d_ptr->ui_toolbar.toolButtonOriginalSize, SIGNAL(clicked()),
+            d_ptr->imageView, SLOT(resetToOriginalSize()));
+    connect(d_ptr->ui_toolbar.toolButtonBackground, SIGNAL(toggled(bool)),
+            d_ptr->imageView, SLOT(setViewBackground(bool)));
+    connect(d_ptr->ui_toolbar.toolButtonOutline, SIGNAL(toggled(bool)),
+            d_ptr->imageView, SLOT(setViewOutline(bool)));
+    connect(d_ptr->imageView, SIGNAL(scaleFactorChanged(qreal)),
+            this, SLOT(scaleFactorUpdate(qreal)));
+}
+
+ImageViewer::~ImageViewer()
+{
+    delete d_ptr->imageView;
+    delete d_ptr->toolbar;
+}
+
+QList<int> ImageViewer::context() const
+{
+    return d_ptr->context;
+}
+
+QWidget *ImageViewer::widget()
+{
+    return d_ptr->imageView;
+}
+
+bool ImageViewer::createNew(const QString &contents)
+{
+    Q_UNUSED(contents)
+    return false;
+}
+
+bool ImageViewer::open(const QString &fileName)
+{
+    if (!d_ptr->imageView->openFile(fileName))
+        return false;
+    setDisplayName(QFileInfo(fileName).fileName());
+    d_ptr->file->setFileName(fileName);
+    // d_ptr->file->setMimeType
+    emit changed();
+    return true;
+}
+
+Core::IFile *ImageViewer::file()
+{
+    return d_ptr->file;
+}
+
+QString ImageViewer::id() const
+{
+    return QLatin1String(Constants::IMAGEVIEWER_ID);
+}
+
+QString ImageViewer::displayName() const
+{
+    return d_ptr->displayName;
+}
+
+void ImageViewer::setDisplayName(const QString &title)
+{
+    d_ptr->displayName = title;
+    emit changed();
+}
+
+bool ImageViewer::duplicateSupported() const
+{
+    return false;
+}
+
+Core::IEditor *ImageViewer::duplicate(QWidget *parent)
+{
+    Q_UNUSED(parent);
+    return 0;
+}
+
+QByteArray ImageViewer::saveState() const
+{
+    return QByteArray();
+}
+
+bool ImageViewer::restoreState(const QByteArray &state)
+{
+    Q_UNUSED(state);
+    return true;
+}
+
+int ImageViewer::currentLine() const
+{
+    return 0;
+}
+
+int ImageViewer::currentColumn() const
+{
+    return 0;
+}
+
+bool ImageViewer::isTemporary() const
+{
+    return false;
+}
+
+QWidget *ImageViewer::toolBar()
+{
+    return d_ptr->toolbar;
+}
+
+void ImageViewer::scaleFactorUpdate(qreal factor)
+{
+    QString info = tr("%1%").arg(QString::number(factor * 100, 'f', 2));
+    d_ptr->ui_toolbar.labelInfo->setText(info);
+}
+
+} // namespace Internal
+} // namespace ImageViewer
diff --git a/src/plugins/imageviewer/imageviewer.h b/src/plugins/imageviewer/imageviewer.h
new file mode 100644
index 00000000000..f18f7d63697
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewer.h
@@ -0,0 +1,85 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef IMAGEVIEWER_H
+#define IMAGEVIEWER_H
+
+#include <coreplugin/editormanager/ieditor.h>
+#include <coreplugin/ifile.h>
+
+#include <QtCore/QScopedPointer>
+#include <QtCore/QStringList>
+
+namespace ImageViewer {
+namespace Internal {
+class ImageViewerFile;
+
+class ImageViewer : public Core::IEditor
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(ImageViewer)
+public:
+    explicit ImageViewer(QWidget *parent = 0);
+    ~ImageViewer();
+
+    QList<int> context() const;
+    QWidget *widget();
+
+    bool createNew(const QString &contents = QString());
+    bool open(const QString &fileName = QString());
+    Core::IFile *file();
+    QString id() const;
+    QString displayName() const;
+    void setDisplayName(const QString &title);
+
+    bool duplicateSupported() const;
+    IEditor *duplicate(QWidget *parent);
+
+    QByteArray saveState() const;
+    bool restoreState(const QByteArray &state);
+
+    int currentLine() const;
+    int currentColumn() const;
+
+    bool isTemporary() const;
+
+    QWidget *toolBar();
+
+public slots:
+    void scaleFactorUpdate(qreal factor);
+
+private:
+    QScopedPointer<struct ImageViewerPrivate> d_ptr;
+};
+
+} // namespace Internal
+} // namespace ImageViewer
+
+#endif // IMAGEVIEWER_H
diff --git a/src/plugins/imageviewer/imageviewer.pro b/src/plugins/imageviewer/imageviewer.pro
new file mode 100644
index 00000000000..b4465c9d08d
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewer.pro
@@ -0,0 +1,31 @@
+TEMPLATE = lib
+TARGET = ImageViewer
+
+include(imageviewer_dependencies.pri)
+
+HEADERS += \
+    imageviewerplugin.h \
+    imageviewerfactory.h \
+    imageviewerfile.h \
+    imageviewer.h \
+    imageview.h \
+    imageviewerconstants.h
+
+SOURCES += \
+    imageviewerplugin.cpp \
+    imageviewerfactory.cpp \
+    imageviewerfile.cpp \
+    imageviewer.cpp \
+    imageview.cpp
+
+RESOURCES += \
+    imageviewer.qrc
+
+OTHER_FILES += \
+    ImageViewer.pluginspec \
+    ImageViewer.mimetypes.xml
+
+QT += svg
+
+FORMS += \
+    imageviewertoolbar.ui
diff --git a/src/plugins/imageviewer/imageviewer.qrc b/src/plugins/imageviewer/imageviewer.qrc
new file mode 100644
index 00000000000..396279668d8
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewer.qrc
@@ -0,0 +1,11 @@
+<RCC>
+    <qresource prefix="/imageviewer">
+        <file>ImageViewer.mimetypes.xml</file>
+        <file>images/outline.png</file>
+        <file>images/zoomin.png</file>
+        <file>images/zoomout.png</file>
+        <file>images/fitinscreen.png</file>
+        <file>images/originalsize.png</file>
+        <file>images/background.png</file>
+    </qresource>
+</RCC>
diff --git a/src/plugins/imageviewer/imageviewer_dependencies.pri b/src/plugins/imageviewer/imageviewer_dependencies.pri
new file mode 100644
index 00000000000..cd650c7aa7d
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewer_dependencies.pri
@@ -0,0 +1,3 @@
+include(../../qtcreatorplugin.pri)
+include(../../libs/utils/utils.pri)
+include(../../plugins/coreplugin/coreplugin.pri)
diff --git a/src/plugins/imageviewer/imageviewerconstants.h b/src/plugins/imageviewer/imageviewerconstants.h
new file mode 100644
index 00000000000..6dc1c427ada
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerconstants.h
@@ -0,0 +1,43 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef IMAGEVIEWERCONSTANTS_H
+#define IMAGEVIEWERCONSTANTS_H
+
+namespace ImageViewer {
+namespace Constants {
+
+const char * const IMAGEVIEWER_ID = "Editors.ImageViewer";
+const char * const IMAGEVIEWER_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Image Viewer");
+
+} // namespace Constants
+} // namespace ImageViewer
+
+#endif // IMAGEVIEWERCONSTANTS_H
diff --git a/src/plugins/imageviewer/imageviewerfactory.cpp b/src/plugins/imageviewer/imageviewerfactory.cpp
new file mode 100644
index 00000000000..c87bf778078
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerfactory.cpp
@@ -0,0 +1,96 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "imageviewerfactory.h"
+#include "imageviewerconstants.h"
+#include "imageviewer.h"
+
+#include <QtCore/QMap>
+#include <QtGui/QImageReader>
+#include <QtCore/QtDebug>
+
+namespace ImageViewer {
+namespace Internal {
+
+ImageViewerFactory::ImageViewerFactory(QObject *parent) :
+    Core::IEditorFactory(parent)
+{
+    QMap<QByteArray, QString> possibleMimeTypes;
+    possibleMimeTypes.insert("bmp", QLatin1String("image/bmp"));
+    possibleMimeTypes.insert("gif", QLatin1String("image/gif"));
+    possibleMimeTypes.insert("ico", QLatin1String("image/x-icon"));
+    possibleMimeTypes.insert("jpeg", QLatin1String("image/jpeg"));
+    possibleMimeTypes.insert("jpg", QLatin1String("image/jpeg"));
+    possibleMimeTypes.insert("mng", QLatin1String("video/x-mng"));
+    possibleMimeTypes.insert("pbm", QLatin1String("image/x-portable-bitmap"));
+    possibleMimeTypes.insert("pgm", QLatin1String("image/x-portable-graymap"));
+    possibleMimeTypes.insert("png", QLatin1String("image/png"));
+    possibleMimeTypes.insert("ppm", QLatin1String("image/x-portable-pixmap"));
+    possibleMimeTypes.insert("svg", QLatin1String("image/svg+xml"));
+    possibleMimeTypes.insert("tif", QLatin1String("image/tiff"));
+    possibleMimeTypes.insert("tiff", QLatin1String("image/tiff"));
+    possibleMimeTypes.insert("xbm", QLatin1String("image/xbm"));
+    possibleMimeTypes.insert("xpm", QLatin1String("image/xpm"));
+
+    QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
+    foreach (const QByteArray &format, supportedFormats) {
+        const QString &value = possibleMimeTypes.value(format);
+        if (!value.isEmpty())
+            m_mimeTypes.append(value);
+    }
+}
+
+Core::IEditor *ImageViewerFactory::createEditor(QWidget *parent)
+{
+    return new ImageViewer(parent);
+}
+
+QStringList ImageViewerFactory::mimeTypes() const
+{
+    return m_mimeTypes;
+}
+
+QString ImageViewerFactory::id() const
+{
+    return QLatin1String(Constants::IMAGEVIEWER_ID);
+}
+
+QString ImageViewerFactory::displayName() const
+{
+    return tr(Constants::IMAGEVIEWER_DISPLAY_NAME);
+}
+
+Core::IFile *ImageViewerFactory::open(const QString & /*fileName*/)
+{
+    return 0;
+}
+
+} // namespace Internal
+} // namespace ImageViewer
diff --git a/src/plugins/imageviewer/imageviewerfactory.h b/src/plugins/imageviewer/imageviewerfactory.h
new file mode 100644
index 00000000000..ff42ac012ec
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerfactory.h
@@ -0,0 +1,65 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef IMAGEVIEWERFACTORY_H
+#define IMAGEVIEWERFACTORY_H
+
+#include <coreplugin/editormanager/ieditorfactory.h>
+#include <coreplugin/editormanager/ieditor.h>
+#include <coreplugin/ifile.h>
+
+#include <QtCore/QStringList>
+
+namespace ImageViewer {
+namespace Internal {
+
+class ImageViewerFactory : public Core::IEditorFactory
+{
+    Q_OBJECT
+public:
+    explicit ImageViewerFactory(QObject *parent = 0);
+
+    Core::IEditor *createEditor(QWidget *parent);
+
+    QStringList mimeTypes() const;
+
+    QString id() const;
+    QString displayName() const;
+
+    Core::IFile *open(const QString &fileName);
+
+private:
+    QStringList m_mimeTypes;
+};
+
+} // namespace Internal
+} // namespace ImageViewer
+
+#endif // IMAGEVIEWERFACTORY_H
diff --git a/src/plugins/imageviewer/imageviewerfile.cpp b/src/plugins/imageviewer/imageviewerfile.cpp
new file mode 100644
index 00000000000..d640221b330
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerfile.cpp
@@ -0,0 +1,145 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "imageviewerfile.h"
+#include "imageviewer.h"
+
+#include <coreplugin/icore.h>
+#include <coreplugin/uniqueidmanager.h>
+
+#include <utils/reloadpromptutils.h>
+
+#include <QtCore/QMap>
+#include <QtCore/QFileInfo>
+#include <QtCore/QtDebug>
+
+namespace ImageViewer {
+namespace Internal {
+
+struct ImageViewerFilePrivate
+{
+    QString fileName;
+    QString mimeType;
+    ImageViewer *editor;
+};
+
+ImageViewerFile::ImageViewerFile(ImageViewer *parent)
+    : Core::IFile(parent),
+    d_ptr(new ImageViewerFilePrivate)
+{
+    d_ptr->editor = parent;
+}
+
+ImageViewerFile::~ImageViewerFile()
+{
+}
+
+Core::IFile::ReloadBehavior ImageViewerFile::reloadBehavior(Core::IFile::ChangeTrigger state,
+                                                            Core::IFile::ChangeType type) const
+{
+    if (type == TypePermissions)
+        return BehaviorSilent;
+    if (type == TypeContents && state == TriggerInternal)
+        return BehaviorSilent;
+    return BehaviorAsk;
+}
+
+void ImageViewerFile::reload(Core::IFile::ReloadFlag flag,
+                             Core::IFile::ChangeType type)
+{
+    if (flag == FlagIgnore)
+        return;
+    if (type == TypePermissions) {
+        emit changed();
+    } else {
+        d_ptr->editor->open(d_ptr->fileName);
+    }
+}
+
+bool ImageViewerFile::save(const QString &fileName)
+{
+    Q_UNUSED(fileName);
+    return false;
+}
+
+void ImageViewerFile::rename(const QString &newName)
+{
+    d_ptr->fileName = newName;
+}
+
+QString ImageViewerFile::fileName() const
+{
+    return d_ptr->fileName;
+}
+
+QString ImageViewerFile::defaultPath() const
+{
+    return QString();
+}
+
+QString ImageViewerFile::suggestedFileName() const
+{
+    return QString();
+}
+
+QString ImageViewerFile::mimeType() const
+{
+    return d_ptr->mimeType;
+}
+
+bool ImageViewerFile::isModified() const
+{
+    return false;
+}
+
+bool ImageViewerFile::isReadOnly() const
+{
+    return true;
+}
+
+bool ImageViewerFile::isSaveAsAllowed() const
+{
+    return false;
+}
+
+void ImageViewerFile::setMimetype(const QString &mimetype)
+{
+    d_ptr->mimeType = mimetype;
+    emit changed();
+}
+
+void ImageViewerFile::setFileName(const QString &filename)
+{
+    d_ptr->fileName = filename;
+    emit changed();
+}
+
+} // namespace Internal
+} // namespace ImageViewer
diff --git a/src/plugins/imageviewer/imageviewerfile.h b/src/plugins/imageviewer/imageviewerfile.h
new file mode 100644
index 00000000000..75b7863c82e
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerfile.h
@@ -0,0 +1,74 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef IMAGEVIEWERFILE_H
+#define IMAGEVIEWERFILE_H
+
+#include <coreplugin/ifile.h>
+
+#include <QtCore/QScopedPointer>
+
+namespace ImageViewer {
+namespace Internal {
+class ImageViewer;
+
+class ImageViewerFile : public Core::IFile
+{
+    Q_OBJECT
+public:
+    explicit ImageViewerFile(ImageViewer *parent = 0);
+    ~ImageViewerFile();
+
+    bool save(const QString &fileName = QString());
+    void rename(const QString &newName);
+    QString fileName() const;
+
+    QString defaultPath() const;
+    QString suggestedFileName() const;
+    QString mimeType() const;
+
+    bool isModified() const;
+    bool isReadOnly() const;
+    bool isSaveAsAllowed() const;
+
+    ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const;
+    void reload(ReloadFlag flag, ChangeType type);
+
+    void setMimetype(const QString &mimetype);
+    void setFileName(const QString &filename);
+
+private:
+    QScopedPointer<struct ImageViewerFilePrivate> d_ptr;
+};
+
+}
+}
+
+#endif // IMAGEVIEWERFILE_H
diff --git a/src/plugins/imageviewer/imageviewerplugin.cpp b/src/plugins/imageviewer/imageviewerplugin.cpp
new file mode 100644
index 00000000000..1dbcfa3426e
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerplugin.cpp
@@ -0,0 +1,78 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "imageviewerplugin.h"
+#include "imageviewerfactory.h"
+#include "imageviewerconstants.h"
+
+#include <QtCore/QDebug>
+
+#include <coreplugin/icore.h>
+#include <coreplugin/mimedatabase.h>
+#include <coreplugin/uniqueidmanager.h>
+#include <extensionsystem/pluginmanager.h>
+
+namespace ImageViewer {
+namespace Internal {
+
+///////////////////////////////// ImageViewerPlugin //////////////////////////////////
+
+ImageViewerPlugin::ImageViewerPlugin()
+{
+}
+
+ImageViewerPlugin::~ImageViewerPlugin()
+{
+}
+
+bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
+{
+    Q_UNUSED(arguments)
+
+    Core::ICore *core = Core::ICore::instance();
+    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/imageviewer/ImageViewer.mimetypes.xml"), errorMessage))
+        return false;
+
+    ImageViewerFactory *factory = new ImageViewerFactory(this);
+    Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
+    aggregate->add(factory);
+
+    addAutoReleasedObject(factory);
+    return true;
+}
+
+void ImageViewerPlugin::extensionsInitialized()
+{
+}
+
+} // namespace Internal
+} // namespace ImageViewer
+
+Q_EXPORT_PLUGIN(ImageViewer::Internal::ImageViewerPlugin)
diff --git a/src/plugins/imageviewer/imageviewerplugin.h b/src/plugins/imageviewer/imageviewerplugin.h
new file mode 100644
index 00000000000..25707252e07
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewerplugin.h
@@ -0,0 +1,60 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (c) 2010 Denis Mingulov.
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef IMAGEVIEWERPLUGIN_H
+#define IMAGEVIEWERPLUGIN_H
+
+#include <extensionsystem/iplugin.h>
+
+#include <QtCore/QtPlugin>
+
+namespace ImageViewer {
+
+namespace Internal {
+class ImageViewerFactory;
+
+class ImageViewerPlugin : public ExtensionSystem::IPlugin
+{
+    Q_OBJECT
+
+public:
+    ImageViewerPlugin();
+    ~ImageViewerPlugin();
+
+    bool initialize(const QStringList &arguments, QString *error_message = 0);
+    void extensionsInitialized();
+
+private:
+};
+
+} // namespace Internal
+} // namespace ImageViewer
+
+#endif // IMAGEVIEWERPLUGIN_H
diff --git a/src/plugins/imageviewer/imageviewertoolbar.ui b/src/plugins/imageviewer/imageviewertoolbar.ui
new file mode 100644
index 00000000000..383929077a6
--- /dev/null
+++ b/src/plugins/imageviewer/imageviewertoolbar.ui
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImageViewer::Internal::ImageViewerToolbar</class>
+ <widget class="QWidget" name="ImageViewer::Internal::ImageViewerToolbar">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>482</width>
+    <height>28</height>
+   </rect>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QToolButton" name="toolButtonBackground">
+     <property name="toolTip">
+      <string>Show background</string>
+     </property>
+     <property name="icon">
+      <iconset resource="imageviewer.qrc">
+       <normaloff>:/imageviewer/images/background.png</normaloff>:/imageviewer/images/background.png</iconset>
+     </property>
+     <property name="checkable">
+      <bool>true</bool>
+     </property>
+     <property name="checked">
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QToolButton" name="toolButtonOutline">
+     <property name="toolTip">
+      <string>Show outline</string>
+     </property>
+     <property name="icon">
+      <iconset resource="imageviewer.qrc">
+       <normaloff>:/imageviewer/images/outline.png</normaloff>:/imageviewer/images/outline.png</iconset>
+     </property>
+     <property name="checkable">
+      <bool>true</bool>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QToolButton" name="toolButtonFitToScreen">
+     <property name="toolTip">
+      <string>Fit image in the screen</string>
+     </property>
+     <property name="icon">
+      <iconset resource="imageviewer.qrc">
+       <normaloff>:/imageviewer/images/fitinscreen.png</normaloff>:/imageviewer/images/fitinscreen.png</iconset>
+     </property>
+     <property name="checkable">
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QToolButton" name="toolButtonOriginalSize">
+     <property name="toolTip">
+      <string>Original size</string>
+     </property>
+     <property name="icon">
+      <iconset resource="imageviewer.qrc">
+       <normaloff>:/imageviewer/images/originalsize.png</normaloff>:/imageviewer/images/originalsize.png</iconset>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QToolButton" name="toolButtonZoomIn">
+     <property name="toolTip">
+      <string>Zoom In</string>
+     </property>
+     <property name="icon">
+      <iconset resource="imageviewer.qrc">
+       <normaloff>:/imageviewer/images/zoomin.png</normaloff>:/imageviewer/images/zoomin.png</iconset>
+     </property>
+     <property name="autoRepeat">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QToolButton" name="toolButtonZoomOut">
+     <property name="toolTip">
+      <string>Zoom Out</string>
+     </property>
+     <property name="icon">
+      <iconset resource="imageviewer.qrc">
+       <normaloff>:/imageviewer/images/zoomout.png</normaloff>:/imageviewer/images/zoomout.png</iconset>
+     </property>
+     <property name="autoRepeat">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="Utils::StyledSeparator" name="widgetToolbarSeparator" native="true"/>
+   </item>
+   <item>
+    <spacer name="horizontalSpacer">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>315</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="Utils::StyledSeparator" name="widgetInfoSeparator" native="true"/>
+   </item>
+   <item>
+    <widget class="QLabel" name="labelInfo"/>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>Utils::StyledSeparator</class>
+   <extends>QWidget</extends>
+   <header>utils/styledbar.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <resources>
+  <include location="imageviewer.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 4e91cd1a695..a7810d191d2 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -9,6 +9,7 @@ SUBDIRS   = plugin_coreplugin \
             plugin_texteditor \
             plugin_cppeditor \
             plugin_bineditor \
+            plugin_imageviewer \
             plugin_bookmarks \
             plugin_projectexplorer \
             plugin_vcsbase \
@@ -74,6 +75,9 @@ plugin_bineditor.subdir = bineditor
 plugin_bineditor.depends = plugin_texteditor
 plugin_bineditor.depends += plugin_coreplugin
 
+plugin_imageviewer.subdir = imageviewer
+plugin_imageviewer.depends = plugin_coreplugin
+
 plugin_designer.subdir = designer
 plugin_designer.depends = plugin_coreplugin plugin_cppeditor plugin_projectexplorer
 
-- 
GitLab