Kaydet (Commit) 9bf3b23a authored tarafından bayram karahan's avatar bayram karahan

1.8.6

üst
This diff is collapsed.
# E-Tahta
Ekranda Sanal Kalem ve Pdf Düzenleyici vb. İşlemler Yapabileceğimiz Yazılım.
![E-Tahta](Clip0014-1.gif)
![E-Tahta](etahta0.png)
![E-Tahta](etahta1.png)
![E-Tahta](etahta2.png)
![E-Tahta](etahta3.png)
![E-Tahta](etahta4.png)
![E-Tahta](etahta5.png)
![E-Tahta](etahta6.png)
![E-Tahta](etahta7.png)
Ekranda Sanal Kalem ve Pdf Düzenleyici vb. İşlemler Yapabileceğimiz Yazılım. E-Tahta
Uygulama Qt ortamında c++ ile yazılmıştır..
<br/>Qt 5.11.2 versiyonu ile yazılmıştır.
<br/>Uygulamada pdf için poppler kütüphanesi kullanılmıştır..
<br/>gcc 4.9 versiyon kullanılmıştır..,
<br/>Derlemek için kodu indiriniz.. kod adında bir dizinde açtığınızı varsayalım
<br/>1-cd kod
<br/>2-mkdir build
<br/>3-cd build
<br/>4-qmake ../E-Tahta.pro
<br/>5-make&make clean
<br/>6-make install
<br/>Bu işlemleri hatasız yaparsanız uygulama derlenecek ve sisteme yüklenecektir..
<br/> etap5 üzerinde derlemek için debhelper 8, libgcc 4.9 ve pro dosyasında opencv imcodecs kütüphanesi iptal edilmesi gerekiyor..
This diff is collapsed.
e-tahta (1.8.6) unstable; urgency=medium
* Initial Release
-- Bayram KARAHAN <bayramk@gmail.com> Sun, 27 Dec 2020 14:31:08 +0300
Source: e-tahta
Section: utils
Priority: optional
Maintainer: Bayram KARAHAN <bayramk@gmail.com>
Build-Depends: debhelper (>= 9),
libc6,
libgcc1,
libgcc-10-dev,
libgl1-mesa-glx | libgl1,
libqt5core5a,
libqt5gui5,
libqt5network5,
libqt5qml5,
libqt5quick5,
libqt5svg5-dev,
libqt5widgets5,
libstdc++6,
qtdeclarative5-dev,
libpoppler-qt5-dev,
libopencv-core-dev,
libopencv-highgui-dev
Standards-Version: 3.9.8
Homepage: http://pardus.org.tr
Package: e-tahta
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends},
libqt5widgets5,
libqt5gui5,
libqt5core5a,
libqt5printsupport5,
libpoppler-qt5-dev,
xdotool,
libopencv-core-dev,
libopencv-highgui-dev
Description: E-Tahta Uygulaması
\ No newline at end of file
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: e-tahta
Source: https://github.com/bayramkarahan/E-Tahta
Files: *
Copyright: 2020 Bayram KARAHAN <bayramk@gmail.com>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
#!/bin/sh
for item in $(ls /home)
do
#echo $item
cp /usr/share/e-tahta/e-tahta.ini /home/$item/
done
exit 0
#copy files to user home
#!/bin/sh
#rm files from user home
#!/usr/bin/make -f
export QT_SELECT := qt5
%:
dh $@
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
\ No newline at end of file
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#include "depo.h"
//int depo::as=0;
int depo::historyBackCount=0;
int depo::historyNextCount=0;
depo::depo()
{
}
//another any where use depo::as
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#ifndef DEPO_H
#define DEPO_H
class depo
{
public:
depo();
//static int as;
static int historyBackCount;
static int historyNextCount;
};
#endif // DEPO_H
This diff is collapsed.
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#include "dotsignal.h"
#include <QBrush>
#include <QColor>
#include <QGraphicsSceneHoverEvent>
#include <QGraphicsSceneMouseEvent>
#include <QDebug>
DotSignal::DotSignal(QGraphicsItem *parentItem, QObject *parent) :
QObject(parent)
{
setParentItem(parentItem);
setAcceptHoverEvents(true);
setBrush(QBrush(Qt::black));
setRect(-4,-4,4,4);
// setRect(0,0,20,20);
setDotFlags(0);
}
DotSignal::DotSignal(QPointF pos, QGraphicsItem *parentItem, QObject *parent) :
QObject(parent)
{
setParentItem(parentItem);
setAcceptHoverEvents(true);
setBrush(QBrush(Qt::black));
//setRect(0,0,20,20);
setRect(-4,-4,4,4);
setPos(pos);
setPreviousPosition(pos);
setDotFlags(0);
}
DotSignal::~DotSignal()
{
}
QPointF DotSignal::previousPosition() const
{
return m_previousPosition;
}
void DotSignal::setPreviousPosition(const QPointF previousPosition)
{
if (m_previousPosition == previousPosition)
return;
m_previousPosition = previousPosition;
emit previousPositionChanged();
}
void DotSignal::setDotFlags(unsigned int flags)
{
m_flags = flags;
}
void DotSignal::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(m_flags & Movable){
auto dx = event->scenePos().x() - m_previousPosition.x();
auto dy = event->scenePos().y() - m_previousPosition.y();
moveBy(dx,dy);
setPreviousPosition(event->scenePos());
emit signalMove(this, dx, dy);
} else {
QGraphicsItem::mouseMoveEvent(event);
}
}
void DotSignal::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if(m_flags & Movable){
setPreviousPosition(event->scenePos());
} else {
QGraphicsItem::mousePressEvent(event);
// qDebug() <<"köşeye tıklandı ";
}
}
void DotSignal::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
emit signalMouseRelease();
QGraphicsItem::mouseReleaseEvent(event);
}
void DotSignal::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
setBrush(QBrush(Qt::red));
}
void DotSignal::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
qDebug() <<"köşe "<<m_flags;
setBrush(QBrush(Qt::black));
// QGraphicsItem::hoverEnterEvent(event);
}
void DotSignal::paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
// fill the box with solid color, use sharp corners
_outterborderPen.setCapStyle(Qt::SquareCap);
_outterborderPen.setStyle(Qt::SolidLine);
painter->setPen(_outterborderPen);
QPointF topLeft (0, 0);
QPointF bottomRight ( 10, 10);//dikkat bura ayarlanacak
QRectF rect (topLeft, bottomRight);
// QPixmap p1(":/icons/erase.png");
//QPixmap p2(":/icons/arrow-up-down.png");
//QPixmap p3(":/icons/rotate-right.png");
if(_outterborderColor!=Qt::red&&m_flags==5) {
_outterborderColor=QColor(0,255,0);
// painter->drawPixmap(-5,-5,p3.scaled(20,20,Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
}
if(_outterborderColor!=Qt::red&&m_flags==2)
{
// _outterborderColor=QColor(255,255,0);
// painter->drawPixmap(-5,-5,ptt.scaled(20,20,Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
}
if(_outterborderColor!=Qt::red&&m_flags==6)
{
_outterborderColor=QColor(0,0,255);
// painter->drawPixmap(-5,-5,p1.scaled(20,20,Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
}
if(_outterborderColor!=Qt::red&&m_flags==4)
{
_outterborderColor=QColor(0,0,0);
// painter->drawPixmap(-5,-5,p2.scaled(20,20,Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
}
if(_outterborderColor!=Qt::red&&m_flags==7) {
_outterborderColor=QColor(0,0,0);
// painter->drawPixmap(-5,-5,p2.scaled(20,20,Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
}
QBrush brush (Qt::SolidPattern);
brush.setColor (_outterborderColor);
painter->fillRect(rect,brush);
}
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#ifndef DOTSIGNAL_H
#define DOTSIGNAL_H
#include <QObject>
#include <QGraphicsRectItem>
#include<QPen>
#include<QPainter>
class QGraphicsSceneHoverEventPrivate;
class QGraphicsSceneMouseEvent;
class DotSignal : public QObject, public QGraphicsRectItem
{
Q_OBJECT
Q_PROPERTY(QPointF previousPosition READ previousPosition WRITE setPreviousPosition NOTIFY previousPositionChanged)
public:
explicit DotSignal(QGraphicsItem *parentItem = 0, QObject *parent = 0);
explicit DotSignal(QPointF pos, QGraphicsItem *parentItem = 0, QObject *parent = 0);
~DotSignal();
enum Flags {
Movable = 0x01
};
QPointF previousPosition() const;
void setPreviousPosition(const QPointF previousPosition);
void setDotFlags(unsigned int flags);
signals:
void previousPositionChanged();
void signalMouseRelease();
void signalMove(QGraphicsItem *signalOwner, qreal dx, qreal dy);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
public slots:
private:
unsigned int m_flags;
QPointF m_previousPosition;
QColor _outterborderColor; ///< the hover event handlers will toggle this between red and black
QPen _outterborderPen; ///< the pen is used to paint the red/black border
};
#endif // DOTSIGNAL_H
#bayram KARAHAN bayramk@gmail.com
[Desktop Entry]
Exec=sh /usr/bin/e-tahtaxdglink.sh
Type=Application
Name[tr_TR.UTF-8]=e-tahta-autostart.desktop
[Desktop Entry]
Version=1.0
Name=E-Tahta Application
Name[tr]=E-Tahta Uygulaması
Type=Application
Comment=Simple Qt based E-Tahta Application
Comment[tr]=Basit Qt tabanlı E-Tahta Uygulaması
Terminal=false
Exec=/usr/bin/e-tahta
Icon=/usr/share/e-tahta/e-tahta.png
Categories=Qt;Utility;
Keywords=zil;etahta;e-tahta;pen,board,tahta;
GenericName=E-Tahta
myPenAlpha=250
myPenColor=#000000
myPenSize=4
myGridSize=2
myEraseSize=2
myPenStyle=1
mySekilPenStyle=1
mySekilZeminColor=#000000
mySekilKalemColor=#000000
myGridColor=#808080
myZeminColor=#000000
mySekilPenSize=2
myZeminType=0
gridYatay=0
gridDikey=0
clock=1
kutuLeft=
kutuTop=19
copyState=0
wsolVisible=0
TARGET = e-tahta
TEMPLATE = app
CONFIG += c++11
INCLUDEPATH += \
/usr/include/opencv4
/usr/include
LIBS += -L/usr/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs
#INCLUDEPATH += /usr/include/poppler/qt5
#LIBS += -L/usr/lib/-lpoppler-qt5
#LIBS += -L/usr/lib/x86_64-linux-gnu/-lpoppler-qt5
#LIBS += -L/usr/local/lib/ -lpoppler-qt5
#https://askubuntu.com/questions/1240998/how-to-install-poppler-0-73-on-ubuntu-20-04-any-change-since-18-04
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib/ -lpoppler-qt5
QMAKE_CXXFLAGS = -std=c++11
QT += widgets gui printsupport xml
QT += network
SOURCES += \
mainwindow.cpp \
main.cpp \
gridlines.cpp \
scene.cpp \
dotsignal.cpp \
verectangle.cpp \
depo.cpp \
singleinstance.cpp
HEADERS += \
mainwindow.h \
gridlines.h \
diagramitem.h \
scene.h \
dotsignal.h \
verectangle.h \
function.h \
buttonclick.h \
popmenu.h \
kalemlayout.h \
filecrud.h \
depo.h \
singleinstance.h
RESOURCES += \
userdrawing.qrc
target.path = /usr/bin
desktop_file.files = e-tahta.desktop
desktop_file.path = /usr/share/applications/
icon.files = icons/e-tahta.png
icon.path = /usr/share/e-tahta/
config_file.files = e-tahta.ini
config_file.path = /usr/share/e-tahta/e-tahta.ini
auto_start.files = e-tahta-autostart.desktop
auto_start.path = /etc/xdg/autostart/
desktopfile.files = e-tahtaxdglink.sh
desktopfile.path = /usr/bin/
INSTALLS += target desktop_file icon config_file auto_start desktopfile
#INSTALLS += libopencvimgcodecs libopencvcore libopencvhighgui libopencvimgproc
DISTFILES += \
icons/e-tahta.png \
e-tahta.ini\
e-tahta-autostart.desktop\
e-tahtaxdglink.sh
#\
# libopencv_core.so.3.4 \
# libopencv_highgui.so.3.4 \
# libopencv_imgproc.so.3.4 \
# libopencv_imgcodecs.so.3.4
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
FILE="$HOME/Masaüstü/e-tahta.desktop"
INIFILE="$HOME/e-tahta.ini"
# init
# look for empty dir
if [ -f $FILE ]; then
cp /usr/share/applications/e-tahta.desktop $FILE
chmod 777 $FILE
chown $HOME:$HOME $FILE
echo "dosya var"
else
cp /usr/share/applications/e-tahta.desktop $FILE
chmod 777 $FILE
chown $HOME:$HOME $FILE
echo "Dosya Kopyalandı.."
fi
if [ -f $INIFILE ]; then
echo "dosya var"
else
cp /usr/share/e-tahta/e-tahta.ini $INIFILE
chmod 777 $INIFILE
chown $HOME:$HOME $INIFILE
echo "Dosya Kopyalandı.."
fi
exit
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#ifndef FILECRUD_H
#define FILECRUD_H
#include<QFile>
#include<QDir>
class FileCrud
{
public:
QString dosya;//FileCrud *fc=new FileCrud();
//fc->dosya="test.txt";
/*fc->fileWrite("bayram=1");
fc->fileWrite("ahmet=6");
fc->fileWrite("mehmet=3");
fc->fileWrite("sabri=2");
fc->fileWrite("fatih=5");
*/
//qDebug()<<fc->fileSearch("mehmet");
// fc->fileEdit(fc->fileSearch("mehmet"),"mehmet=88\n");
//fc->fileDelete("sabri\n");
//fc->fileRead();
/*fc->fileWrite("bayram=1");
fc->fileWrite("ahmet=6");
fc->fileWrite("mehmet=3");
fc->fileWrite("sabri=2");
fc->fileWrite("fatih=5");
*/
//qDebug()<<fc->fileexists();
void fileremove()
{
QFile file(QDir::homePath()+"/"+dosya);
//const QString yol=QDir::homePath()+"/"+dosya;
//bool snc=QDir::remove(yol);
file.remove();
}
bool fileexists()
{
QFile file(QDir::homePath()+"/"+dosya);
// QFile file(dosya);
if(file.exists()) return true; else return false;
}
void fileWrite(QString veri)
{
QFile data(QDir::homePath()+"/"+dosya);
QFile newData(QDir::homePath()+"/"+dosya);
/*for writing line by line to text file */
/* if (file.open(QIODevice::ReadWrite))
{
QTextStream stream(&file);
stream << "1_XYZ="<<"abc"<<endl;
stream << "2_XYZ="<<"xyx"<<endl;
}
*/
// QFile data("/home/etapadmin/.config/eta/virtualkeyboard/config.ini");
data.open(QIODevice::Text | QIODevice::ReadOnly);
QString dataText = data.readAll();
// QRegularExpression re("AutoShow=true");
// QString replacementText("AutoShow=false");
// dataText.replace(re, replacementText);
dataText.append(veri+"\n");
//QFile newData("/home/etapadmin/.config/eta/virtualkeyboard/config.ini");
if(newData.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&newData);
out << dataText;
}
newData.close();
}
void fileRead()
{
QFile file(QDir::homePath()+"/"+dosya);
/*
* If file not exit it will create
* */
if (!file.open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::ReadWrite))
{
qDebug() << "FAIL TO CREATE FILE / FILE NOT EXIT***";
}
/*for Reading line by line from text file*/
while (!file.atEnd()) {
QByteArray line = file.readLine();
qDebug() << "read output - " << line;
}
}
QString fileSearch(QString data)
{
QString rdata;
QFile file(QDir::homePath()+"/"+dosya);
/*
* If file not exit it will create
* */
if (!file.open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::ReadWrite))
{
qDebug() << "FAIL TO CREATE FILE / FILE NOT EXIT***";
}
QRegularExpression re(data);
/*for Reading line by line from text file*/
while (!file.atEnd()) {
QString line = file.readLine();
// qDebug() << "read output - " << line;
if(line.contains(re)) rdata=line; //qDebug()<<"bulundu......";
}
return rdata;
}
void fileDelete(QString delveri)
{
// qDebug()<<"selamf";
QFile data(QDir::homePath()+"/"+dosya);
QFile newData(QDir::homePath()+"/"+dosya);
data.open(QIODevice::Text | QIODevice::ReadOnly);
QString dataText = data.readAll();
QRegularExpression re(delveri);
QString replacementText("");
dataText.replace(re, replacementText);
//dataText.remove(delveri);
if(newData.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&newData);
out << dataText;
}
newData.close();
}
void fileEdit(QString oldveri,QString newveri)
{
// qDebug()<<"selamf";
QFile data(QDir::homePath()+"/"+dosya);
QFile newData(QDir::homePath()+"/"+dosya);
data.open(QIODevice::Text | QIODevice::ReadOnly);
QString dataText = data.readAll();
QRegularExpression re(oldveri);
QString replacementText(newveri);
dataText.replace(re, replacementText);
if(newData.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&newData);
out << dataText;
}
newData.close();
}
};
#endif // FILECRUD_H
This diff is collapsed.
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#include "gridlines.h"
#include<QPalette>
#include <QStyleOptionGraphicsItem>
#include<QtDebug>
GridLines::GridLines(int w, int h ,int space,bool gridYatay,bool gridDikey,bool guzelYazi, QColor backColor,QColor lineColor) : QGraphicsItem(),
_width(w), _height(h), _space(space),_backColor(backColor),_lineColor(lineColor),_gridYatay(gridYatay),_gridDikey(gridDikey),_guzelYazi(guzelYazi)
{
}
QPixmap GridLines::PixItem(QGraphicsItem *item, int w, int h){
QPixmap pixmap(w,h);
//QPixmap pixmap(item->boundingRect().size().toSize());
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
QStyleOptionGraphicsItem opt;
item->paint(&painter,&opt);
return pixmap;
}
QPixmap GridLines::PixItemscene(QGraphicsItem *item){
// QPixmap pixmap(w,h);
QPixmap pixmap(item->boundingRect().size().toSize());
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
QStyleOptionGraphicsItem opt;
item->paint(&painter,&opt);
return pixmap;
}
/*
QPixmap GridLines::image() const
{
QPixmap pixmap(1024, 768);
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
painter.setPen(QPen(Qt::black, 8));
painter.translate(125, 125);
//painter.drawPixmap(this);
return pixmap;
}
*/
void GridLines::paint (QPainter *_painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
// re-draw the grid lines from 0,0 to _width, _height
// do horizontal first
//QColor c (200,200,255,125);
// qDebug()<<"renk"<<_backColor;
_painter->setPen(_lineColor);
_painter->setBrush(QBrush(_backColor));
_painter->drawRect(0,0,_width, _height);
if(_guzelYazi)
{
int a=1;
for (int y= _space; y < _height; y+=_space)
{
if(a==1){ _painter->setPen(QColor(0,0,255,255));
_painter->drawLine(0,y, _width, y);
y=y-_space/3;
}
if(a==2)
{ _painter->setPen(QColor(255,0,0,255));
_painter->drawLine(0,y, _width, y);
// a=0;//return;
}
else if(a==3)
{ _painter->setPen(QColor(255,0,0,255));
_painter->drawLine(0,y, _width, y);
// a=0;//return;
y=y-_space/3;
}
else if(a==4)
{ _painter->setPen(QColor(0,0,255,255));
_painter->drawLine(0,y, _width, y);
y=y+_space/4;
a=0;//return;
}
/* else if(a==5)
{ _painter->setPen(QColor(0,255,0,255));
// _painter->drawLine(0,y, _width, y);
a=0;//return;
}
*/
a++;
}
}
if(_gridYatay)
{
for (int y= _space; y < _height; y+=_space)
{
_painter->drawLine(0,y, _width, y);
}
}
if(_gridDikey)
{
for (int x= 0; x < _width; x+=_space)
{
_painter->drawLine(x,0, x, _height);
}
}
}
QRectF GridLines::boundingRect() const
{
return QRectF ( static_cast<qreal>(0), static_cast<qreal>(0), static_cast<qreal>(_width), static_cast<qreal>( _height));
}
void GridLines::handleWindowSizeChanged(int w, int h)
{
_width = w;
_height = h;
}
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
/*****************************************************************************
* Copyright (C) 2020 by Bayram KARAHAN *
* <bayramk@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#ifndef GRIDLINES_H
#define GRIDLINES_H
#include <QGraphicsItem>
#include <QPainter>
#include <QRectF>
#include <QColor>
#include <QGraphicsSceneHoverEvent>
#include <QGraphicsSceneMouseEvent>
#include <QStyleOptionGraphicsItem>
class GridLines : public QGraphicsItem
{
public:
GridLines(int width, int height, int space,bool gridYatay,bool gridDikey, bool guzelYazi,QColor backColor,QColor lineColor);
public :
void handleWindowSizeChanged(int w, int h);
// QPixmap image() const;
QPixmap PixItem(QGraphicsItem *item,int w,int h);
QPixmap PixItemscene(QGraphicsItem *item);
private:
int _width;
int _height;
int _space;
bool _gridYatay;
bool _gridDikey;
bool _guzelYazi;
QColor _backColor;
QColor _lineColor;
virtual QRectF boundingRect() const; ///< must be re-implemented in this class to provide the diminsions of the box to the QGraphicsView
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); ///< must be re-implemented here to pain the box on the paint-event
};
#endif // GRIDLINES_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment