From 33959d38820bb73724b6247c5b14fa8d40750cc8 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 16 Nov 2016 01:31:06 +0300 Subject: [PATCH 1/2] Icons have been changed --- limereport/images/addBand1.png | Bin 450 -> 205 bytes limereport/images/addBand2.png | Bin 0 -> 229 bytes limereport/images/delete2.png | Bin 0 -> 460 bytes limereport/images/edit_control_4_24.png | Bin 0 -> 290 bytes limereport/images/hlayuot_4_24.png | Bin 0 -> 210 bytes limereport/items/images/barcode4.png | Bin 0 -> 171 bytes limereport/items/images/barcode5.png | Bin 0 -> 221 bytes limereport/items/images/imageItem4.png | Bin 0 -> 259 bytes limereport/items/images/insert-text_6.png | Bin 409 -> 226 bytes limereport/items/images/shapes7.png | Bin 0 -> 648 bytes limereport/items/items.qrc | 14 +++++++++----- limereport/report.qrc | 12 ++++++++---- 12 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 limereport/images/addBand2.png create mode 100644 limereport/images/delete2.png create mode 100644 limereport/images/edit_control_4_24.png create mode 100644 limereport/images/hlayuot_4_24.png create mode 100644 limereport/items/images/barcode4.png create mode 100644 limereport/items/images/barcode5.png create mode 100644 limereport/items/images/imageItem4.png create mode 100644 limereport/items/images/shapes7.png diff --git a/limereport/images/addBand1.png b/limereport/images/addBand1.png index d83b77efb9ed0a6dc50ab59eaff2a053a6440b8b..d559323d0a60a5d0758e9a4f3487c0ac9ad041f8 100644 GIT binary patch delta 119 zcmX@ae3o&73aes(Pl)Tp5=FUypUFEI7#J8!g8YIR9G=}s196hP-CYzopr04gaX5&!@I delta 365 zcmX@hc!+s|N&ri`qpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgVG!UG;;LJ+N@1|qNbw8{HfEIBcz8V0CMPrOl2c@s zV0q;T6kMkGvoX;%h?VD=(H%RM_T`0E?wto25@#70xic^iWSDQ3Nk7|v$1*Rc=`e+QG z)c^ng1AZp&04ioI3GxeOaCmkj4a7H=O_6OYjVm$m8n`EtkLbjeRjv*44lM@v9B#f06ni=_A9VFFMRasS4RTWy#9n3Wg zkmFLQ5|9yDyzxb%!?nW>9{ihnHZsac8BbtjnDmOr<8Ov4nJa0`PlBg3pYAU*6Qp1!W^54ico#Kp63_U!RbWQq!>L-TnXk_V#~s z=S(eNTGrRd8aXd`MykCu|7Hd`c1wkgtP&CuA{RsrHX2zO7#MIQ{ZPnTw6b}D(eb)0 zmp8w6+slYQoo{!*fxkiUq@=g*@5r4qc~2O=`F?%Bc$$m6zKdA0WB8F%XLAl5JpaZ) zSKi>^q#wUu+c)d1mIL9#K<^m-(AmH9!Jq&2{~vE@U|r6-|G)8*DF37cAkesxb^O4A z0}Y4%AN$a%cwO{h`r|Z}v+O4PivqdbbR`_c9-KM3MyBV3%$ZXMJ0>kI{OGx6yMBbZm3CJ0StErPgg&ebxsLQ0JUPj ABme*a literal 0 HcmV?d00001 diff --git a/limereport/images/edit_control_4_24.png b/limereport/images/edit_control_4_24.png new file mode 100644 index 0000000000000000000000000000000000000000..1964712e14ae1cce622edb14638d38f94aa0eee4 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJa0`PlBg3pYAU*6Qp1!W^54icogarSek#7SEt@m_s4DmRgoFKu<%qua`vQXIf zfAHZ8u0NMQe70$Uch~E}z?2`Sz3&J7@Hvw8#O{U1v{s)ZQgQL|{?k-_w)8zYn9jKJ zpvxxK4LcOBDQ#-*i0IbnV|H5E-8yB%y7lXidp%~>*-^AeXcA*@Z?DSpgr)@x7e1_a zc0OF6xdS@h(>g$o_S*T?ayr8p!fD>ECuI>Dz^bI^H`>JzDRPHR-B e96Ne}m0_OtRJ%^OQ&m8xGkCiCxvX4nJaD4z_MyE9<_s4MR=LEu4!2T6pHtBaSZV|o}3`T%EF**q@K6v zWqk>2_a}ejB;n)g+co~1+=&q@@hr5}v-tgVX@0@CLwkZXUOiHuDR|}Z0U&UBtsu2E z;Yw2=x0|lS)&?nt#dZ$*=QmFMf8>=Us|zE8@Js29syCni0b0f2>FVdQ&MBb@0LlVI Ah5!Hn literal 0 HcmV?d00001 diff --git a/limereport/items/images/barcode4.png b/limereport/items/images/barcode4.png new file mode 100644 index 0000000000000000000000000000000000000000..635b9776295b6e20e651fe2cfa8e9a0f5ef2672a GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYYs>cdx@v7EBga(enBI~q7Al3fkGCZE{-7{$CDEzSev?s9 z-rL5g7G+&^r74ixO;=)T!<|EYv(k8c1RiQPb?Pp2Klp%=p`=M;TUG9hc|bE5JYD@< J);T3K0RTn6GE4vf literal 0 HcmV?d00001 diff --git a/limereport/items/images/barcode5.png b/limereport/items/images/barcode5.png new file mode 100644 index 0000000000000000000000000000000000000000..5c195c28867b6b448441fd5a87f66f1a06af7c72 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJa0`PlBg3pYAU*6Qp1!W^54icoBup(8gzo}{vOHZJLp+WrCoC{bNJ&UY=$M`H zYra^U{we#jCzu}VoUwKdJ^WaGrlA1{T(s(FTgbX$!(q3_lbx5fR|@n-8Dt%Nu(^RT zEaotS(d>|hJia*j2ij~Mno0$~8loB&@Vf;I@@!b(erEzRL*%c$*OGsq`U13-!PC{x JWt~$(6973cM&tkh literal 0 HcmV?d00001 diff --git a/limereport/items/images/imageItem4.png b/limereport/items/images/imageItem4.png new file mode 100644 index 0000000000000000000000000000000000000000..589cc691ba697da4a478ed56a744f467df390cbb GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJaD4z_MyE9<_s4#Uy#^?N&_z3Qh2IaSZV|o}3`@szLBr$Lx$> z^JlT?pRzxD;s6jd>Fh9gFA~brKR<;n-T0zaM?q9T*@4D|ZyK0$bsWrQ1bMTmb?lPi zOGur}98usIkoDof@UP->aylbL#~E87pL;sZ4b> z(big#Y7xf0B2mMSdqu8=TjZBdm(1G&8~7OBEZ1AOXQ}%_pxYQcUHx3vIVCg!0AZnA A8~^|S literal 0 HcmV?d00001 diff --git a/limereport/items/images/insert-text_6.png b/limereport/items/images/insert-text_6.png index 0d68f8e8768dbfc049d43b4bc2dda169b8b38f76..ac5982ddd05c60bba10c7d988bda4034e8200c7a 100644 GIT binary patch delta 182 zcmbQq{D^Uagfs^m0|Uc@a@!w3iY>|8-Gw2JVIqU+6{b6e6L%=o^NUGy+9uh|1j^=n zx;Tb-98XS=c-0_ytYdb@ulcjs^iSEJJ#hdCnsjy;ycY@O>7Sp%mTr8}sv{$hk=yR% zCT2bt$xBZQ8f>^Pm>$+SqGp!hc*JGh_0CY^FTodAuqq#55=#NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5l+X(B32_C|`5UeCmzn2I zQc0U>9J@#_Yn5riMk|ou2CIUN)&)RvllA}q|3k|a7=fyJN`m}?84iiDv2ckWp1tJ7 zLZ2tSxY-fvqHzXCa&1s;*b3=FJ>Ak4V^tp>>P>?NMQuIvxESwt1p(qf-I z1Pa-Ex;TbNTux3nznC}Q!>*kacgk-w)GWI1B0ilpUXO@geCy9eR$RY diff --git a/limereport/items/images/shapes7.png b/limereport/items/images/shapes7.png new file mode 100644 index 0000000000000000000000000000000000000000..a9920f5451c95bc16b54f4ae68df5b601d391253 GIT binary patch literal 648 zcmV;30(bq1P)K*e7pTG$&^`gY0q_JsU!Xm{%_Bsi{ zHr^^7X)|7D_xomNzZnz#XH)R={$RbvuJW%SpSHg%lXJ$~V|UE&ja2Y*>1CGmyebX; z>!e3h;D_usL4dhB%XBb!Re*0G`k4|4@V!a!nGr;R!%{Lp_RWB-jzf+)oc`-D3_S4( zTzg2ZbBo$_%bVw)roEx1eevk?8r)|-$*wek(;v{EQ`1w}lhrI0%DVUL+5LYm&5yX>a_G8oOUn!#7)UW^lB%eK#|gSuHszKy9^m70Q>qfVN`^EY5FsK?_Yw6nJ2BKEY-z z0VJ7O)TF_KRAC*`q&~I~;N43*G5F|m#mQp}&1^az!NN0L3OuxuTW4mpn)n15QdR%g zs}Vzq=q->~4T>nO=A@$*X*IZYtf?X3uTl0qwz$yhSS)M3-`<{s2PzWa__}>$_9J+x z2Q`t@kV;-}i2Y-N5O917zYN{sKH5bR5`goG+x+-$RCrO~f&Kj2`1a~exzletZwK6) za4%|le03ZEnH`rp7Zz&A5N*3Yk~)L0u>TPTK9xSK+YuF7M2kj8MMH#Ikn_m>;si2Z iuoWmRXlQYEC%^y}fe*{3!pVLB0000images/insert-text_5.png images/shape5.png images/imageItem1.png - images/imageItem2.png + images/imageItem2.png images/settings.png images/settings2.png - images/hlayuot_3_24.png + images/hlayuot_3_24.png images/addBand1.png images/DataBand.png images/PageHeader.png @@ -34,8 +34,12 @@ images/GroupHeader16.png images/ReportPage16.png images/insert-text_6.png - images/barcode3.png - images/shape6.png - images/imageItem3.png + images/barcode3.png + images/shape6.png + images/imageItem3.png + images/barcode4.png + images/imageItem4.png + images/shapes7.png + images/barcode5.png diff --git a/limereport/report.qrc b/limereport/report.qrc index 6dfc6fe..0f74519 100644 --- a/limereport/report.qrc +++ b/limereport/report.qrc @@ -121,11 +121,11 @@ images/text_bold1.png images/text_italic1.png images/text_underline1.png - images/edit_control_3_24.png + images/edit_control_3_24.png images/edit_layout_4_24.png - images/hlayuot_3_24.png - images/addBand1.png - images/delete1.png + images/hlayuot_3_24.png + images/addBand1.png + images/delete1.png images/copy2.png images/new_leaf1.png images/paste1.png @@ -170,5 +170,9 @@ images/toolbar.png images/not_checked.png images/checked.png + images/hlayuot_4_24.png + images/delete2.png + images/addBand2.png + images/edit_control_4_24.png From 2fb47a5830d2dc8615f5fb98957015d0a6d5379a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 17 Nov 2016 00:37:37 +0300 Subject: [PATCH 2/2] Connect connection has been refactored --- limereport/items/items.qrc | 2 +- limereport/lrdatadesignintf.cpp | 10 ++++ limereport/lrdatadesignintf.h | 1 + limereport/lrdatasourcemanager.cpp | 90 ++++++++++++++++++------------ limereport/lrdatasourcemanager.h | 1 + 5 files changed, 67 insertions(+), 37 deletions(-) diff --git a/limereport/items/items.qrc b/limereport/items/items.qrc index aec5e59..07cc670 100644 --- a/limereport/items/items.qrc +++ b/limereport/items/items.qrc @@ -11,7 +11,7 @@ images/insert-text_5.png images/shape5.png images/imageItem1.png - images/imageItem2.png + images/imageItem2.png images/settings.png images/settings2.png images/hlayuot_3_24.png diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index b9a15dd..3b24e66 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -369,6 +369,16 @@ void ConnectionDesc::setName(const QString &value) m_connectionName=value; } +bool ConnectionDesc::isEqual(const QSqlDatabase &db) +{ + return (db.databaseName() == m_databaseName) && + (db.driverName() == m_connectionDriver) && + (db.hostName() == m_connectionHost) && + (db.connectionName() == m_connectionName) && + (db.userName() == m_user) && + (db.password() == m_password); +} + QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) :m_queryName(queryName), m_queryText(queryText), m_connectionName(connection) {} diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index e53056f..abe26bb 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -129,6 +129,7 @@ public: QString password(){return m_password;} void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} + bool isEqual(const QSqlDatabase& db); signals: void nameChanged(const QString& oldName,const QString& newName); private: diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index b6c25d3..42ec024 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -634,6 +634,7 @@ bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection) QSqlDatabase::removeDatabase(connection->name()); return true; } + QSqlDatabase::removeDatabase(connection->name()); return false; } @@ -672,8 +673,38 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc) } else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(proxyDesc->name())); } +bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){ + + bool connected = false; + db.setHostName(replaceVariables(connectionDesc.host())); + db.setUserName(replaceVariables(connectionDesc.userName())); + db.setPassword(replaceVariables(connectionDesc.password())); + + QString dbName = replaceVariables(connectionDesc.databaseName()); + if (connectionDesc.driver().compare("QSQLITE")==0){ + if (!defaultDatabasePath().isEmpty()){ + dbName = !QFileInfo(dbName).exists() ? + defaultDatabasePath()+QFileInfo(dbName).fileName() : + dbName; + } + if (QFileInfo(dbName).exists()){ + db.setDatabaseName(dbName); + } else { + setLastError(tr("Database \"%1\" not found").arg(dbName)); + return false; + } + } else { + db.setDatabaseName(dbName); + } + + connected=db.open(); + if (!connected) setLastError(db.lastError().text()); + return connected; +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { + bool connected = false; clearErrors(); QString lastError =""; @@ -682,11 +713,31 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) dataSourceHolder(datasourceName)->clearErrors(); } - if (QSqlDatabase::contains(connectionDesc->name())){ + if (!QSqlDatabase::contains(connectionDesc->name())){ + QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); + connected=initAndOpenDB(db, *connectionDesc); + if (!connected){ + setLastError(db.lastError().text()); + return false; + } + } else { + QSqlDatabase db = QSqlDatabase::database(connectionDesc->name()); + if (!connectionDesc->isEqual(db)){ + db.close(); + connected = initAndOpenDB(db, *connectionDesc); + } else { + connected = db.isOpen(); + } + } + + if (!connected) { + QSqlDatabase::removeDatabase(connectionDesc->name()); + return false; + } else { foreach(QString datasourceName, dataSourceNames()){ if (isQuery(datasourceName)){ QueryHolder* qh = dynamic_cast(dataSourceHolder(datasourceName)); - if (qh && qh->connectionName().compare(connectionDesc->name())==0){ + if (qh){ qh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); invalidateChildren(datasourceName); } @@ -700,41 +751,8 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } } } - - QSqlDatabase::removeDatabase(connectionDesc->name()); + if (designTime()) emit datasourcesChanged(); } - - QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - db.setHostName(replaceVariables(connectionDesc->host())); - db.setUserName(replaceVariables(connectionDesc->userName())); - db.setPassword(replaceVariables(connectionDesc->password())); - QString dbName = replaceVariables(connectionDesc->databaseName()); - if (connectionDesc->driver().compare("QSQLITE")==0){ - if (!defaultDatabasePath().isEmpty()){ - dbName = !QFileInfo(dbName).exists() ? - defaultDatabasePath()+QFileInfo(dbName).fileName() : - dbName; - } - if (QFileInfo(dbName).exists()){ - db.setDatabaseName(dbName); - connected=db.open(); - } else { - lastError = tr("Database \"%1\" not found").arg(dbName); - } - } else { - db.setDatabaseName(dbName); - connected=db.open(); - if (!connected) lastError=db.lastError().text(); - } - - if (designTime()) emit datasourcesChanged(); - - if (!connected) { - QSqlDatabase::removeDatabase(connectionDesc->name()); - setLastError(lastError); - return false; - } - return true; } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 1567ae5..fcf0f99 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -220,6 +220,7 @@ private slots: void slotQueryTextChanged(const QString& queryName, const QString& queryText); private: explicit DataSourceManager(QObject *parent = 0); + bool initAndOpenDB(QSqlDatabase &db, ConnectionDesc &connectionDesc); Q_DISABLE_COPY(DataSourceManager) private: QList m_connections;