added for plugins own dir
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1850 b45a01b8-16f6-495d-af2f-9b41ad6348cc
|
@ -1,50 +0,0 @@
|
|||
# -------------------------------------------------
|
||||
# Project created by QtCreator 2009-06-24T21:25:25
|
||||
# -------------------------------------------------
|
||||
#=== this part is common (similar) for all plugin projects =====================
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin release
|
||||
|
||||
# this is directory, where PluginInterface.h is located
|
||||
INCLUDEPATH += ../
|
||||
|
||||
# and, the result (*.so or *.dll) should appear in this directory
|
||||
DESTDIR = ../bin
|
||||
OBJECTS_DIR = temp/obj
|
||||
RCC_DIR = temp/qrc
|
||||
UI_DIR = temp/ui
|
||||
MOC_DIR = temp/moc
|
||||
|
||||
|
||||
# the name of the result file;
|
||||
TARGET = $$qtLibraryTarget(colorcode_plugin)
|
||||
|
||||
HEADERS += ../PluginInterface.h \
|
||||
ColorCodePlugin.h
|
||||
SOURCES += ColorCodePlugin.cpp
|
||||
|
||||
#===============================================================================
|
||||
|
||||
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
colorpeg.cpp \
|
||||
rowhint.cpp \
|
||||
pegrow.cpp \
|
||||
msg.cpp \
|
||||
about.cpp
|
||||
HEADERS += mainwindow.h \
|
||||
colorpeg.h \
|
||||
rowhint.h \
|
||||
pegrow.h \
|
||||
msg.h \
|
||||
about.h
|
||||
RESOURCES += resource.qrc
|
||||
FORMS += about.ui
|
||||
OTHER_FILES += docs/GPL.html \
|
||||
trans_en.ts \
|
||||
trans_de.ts
|
||||
TRANSLATIONS = trans_en.ts \
|
||||
trans_de.ts
|
||||
CODECFORTR = UTF-8
|
||||
CODECFORSRC = UTF-8
|
|
@ -1,28 +0,0 @@
|
|||
# -------------------------------------------------
|
||||
# Project created by QtCreator 2009-06-24T21:25:25
|
||||
# -------------------------------------------------
|
||||
TARGET = ColorCode
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
colorpeg.cpp \
|
||||
rowhint.cpp \
|
||||
pegrow.cpp \
|
||||
msg.cpp \
|
||||
about.cpp
|
||||
HEADERS += mainwindow.h \
|
||||
colorpeg.h \
|
||||
rowhint.h \
|
||||
pegrow.h \
|
||||
msg.h \
|
||||
about.h
|
||||
RESOURCES += resource.qrc
|
||||
FORMS += about.ui
|
||||
OTHER_FILES += docs/GPL.html \
|
||||
trans_en.ts \
|
||||
trans_de.ts
|
||||
RC_FILE = ColorCode.rc
|
||||
TRANSLATIONS = trans_en.ts \
|
||||
trans_de.ts
|
||||
CODECFORTR = UTF-8
|
||||
CODECFORSRC = UTF-8
|
|
@ -1 +0,0 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "cc32.ico"
|
|
@ -1,53 +0,0 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009 RetroShare Team
|
||||
*
|
||||
* 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 2
|
||||
* 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 <QApplication>
|
||||
//#include <QString>
|
||||
//#include <QPushButton>
|
||||
|
||||
#include "ColorCodePlugin.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
QString
|
||||
ColorCodePlugin::pluginDescription() const
|
||||
{
|
||||
QString res;
|
||||
res = "a StegoSaurus plugin" ;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QString
|
||||
ColorCodePlugin::pluginName() const
|
||||
{
|
||||
return "ColorCode" ;
|
||||
}
|
||||
|
||||
QWidget*
|
||||
ColorCodePlugin::pluginWidget(QWidget * parent )
|
||||
{
|
||||
MainWindow* window = new MainWindow();
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2(colorcode_plugin, ColorCodePlugin)
|
|
@ -1,48 +0,0 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009 RetroShare Team
|
||||
*
|
||||
* 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 2
|
||||
* 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 _COLORCODE_PLUGIN_H_
|
||||
#define _COLORCODE_PLUGIN_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <PluginInterface.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class ColorCodePlugin: public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
public slots:
|
||||
|
||||
virtual QString pluginDescription() const ;
|
||||
virtual QString pluginName() const ;
|
||||
|
||||
virtual QWidget* pluginWidget(QWidget * parent = 0) ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
ColorCode 0.1
|
||||
|
||||
simply run:
|
||||
|
||||
qmake-qt4 -project
|
||||
qmake-qt4
|
||||
make
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#include "about.h"
|
||||
|
||||
About::About(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||
{
|
||||
setupUi(this);
|
||||
setWindowIcon(QIcon(QPixmap(":/img/help-about.png")));
|
||||
mAuthorIcon->setPixmap(QPixmap(":/img/cc32.png"));
|
||||
mLicenseIcon->setPixmap(QPixmap(":/img/GNU-icon32.png"));
|
||||
|
||||
mAuthorText->setText("<b>" + tr("ColorCode") + "</b><br>" +
|
||||
tr("A needful game to train your brain ;-)") +
|
||||
"<br><br>Version: 0.2<br>Author: Dirk Laebisch");
|
||||
|
||||
QString license_file = ":/docs/GPL.html";
|
||||
if (QFile::exists(license_file))
|
||||
{
|
||||
QFont fixed_font;
|
||||
fixed_font.setStyleHint(QFont::TypeWriter);
|
||||
fixed_font.setFamily("Courier");
|
||||
mLicenseText->setFont(fixed_font);
|
||||
|
||||
QFile f(license_file);
|
||||
if (f.open(QIODevice::ReadOnly))
|
||||
{
|
||||
mLicenseText->setText(QString::fromUtf8(f.readAll().constData()));
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
mLicenseText->setText(
|
||||
"<i>" +
|
||||
tr("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 2 of the License, or "
|
||||
"(at your option) any later version.") + "</i>"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
About::~About()
|
||||
{
|
||||
}
|
||||
|
||||
QSize About::sizeHint () const
|
||||
{
|
||||
return QSize(320, 240);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef ABOUT_H
|
||||
#define ABOUT_H
|
||||
|
||||
#include "ui_about.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFile>
|
||||
|
||||
class About : public QDialog, public Ui::About
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
About(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
~About();
|
||||
|
||||
virtual QSize sizeHint () const;
|
||||
};
|
||||
|
||||
#endif // ABOUT_H
|
|
@ -1,185 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>About</class>
|
||||
<widget class="QDialog" name="About">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About ColorCode</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mAuthorTab">
|
||||
<attribute name="title">
|
||||
<string>&Author</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="mAuthorIcon">
|
||||
<property name="text">
|
||||
<string>icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>111</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="mAuthorText">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLicenseTab">
|
||||
<attribute name="title">
|
||||
<string>&License</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="mLicenseIcon">
|
||||
<property name="text">
|
||||
<string>icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>111</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="mLicenseText">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>mAuthorText</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>mLicenseText</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>About</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1,232 +0,0 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "colorpeg.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
const QBrush ColorPeg::mShadowBrush = ColorPeg::GetShadowBrush();
|
||||
const QPen ColorPeg::mPen = ColorPeg::GetOutlinePen();
|
||||
|
||||
QBrush ColorPeg::GetShadowBrush()
|
||||
{
|
||||
QRadialGradient rgrad(22, 22, 22, 22, 22);
|
||||
rgrad.setColorAt(0.3, QColor(0, 0, 0, 0xff));
|
||||
rgrad.setColorAt(1.0, QColor(0, 0, 0, 0));
|
||||
|
||||
return QBrush(rgrad);
|
||||
}
|
||||
|
||||
QPen ColorPeg::GetOutlinePen()
|
||||
{
|
||||
QRadialGradient rgrad(20, 20, 32, 0, 0);
|
||||
rgrad.setColorAt(0.0, Qt::black);
|
||||
rgrad.setColorAt(1.0, Qt::white);
|
||||
return QPen(QBrush(rgrad), 2);
|
||||
}
|
||||
|
||||
|
||||
ColorPeg::ColorPeg(QObject*)
|
||||
{
|
||||
setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
||||
mPegType = NULL;
|
||||
mPegRow = NULL;
|
||||
SetBtn(true);
|
||||
mIsDragged = false;
|
||||
mId = -1;
|
||||
}
|
||||
|
||||
ColorPeg::~ColorPeg()
|
||||
{
|
||||
}
|
||||
|
||||
void ColorPeg::SetPegType(PegType *pt)
|
||||
{
|
||||
mPegType = pt;
|
||||
setFlags(ItemIsMovable | ItemIsSelectable);
|
||||
}
|
||||
|
||||
void ColorPeg::SetPegRow(PegRow *pr)
|
||||
{
|
||||
mPegRow = pr;
|
||||
}
|
||||
|
||||
PegType* ColorPeg::GetPegType()
|
||||
{
|
||||
return mPegType;
|
||||
}
|
||||
|
||||
void ColorPeg::SetId(int id)
|
||||
{
|
||||
mId = id;
|
||||
}
|
||||
|
||||
bool ColorPeg::IsBtn() const
|
||||
{
|
||||
return mIsBtn;
|
||||
}
|
||||
|
||||
void ColorPeg::SetBtn(bool b)
|
||||
{
|
||||
mIsBtn = b;
|
||||
SetCursorShape();
|
||||
}
|
||||
|
||||
int ColorPeg::GetType() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
void ColorPeg::SetType(const int t)
|
||||
{
|
||||
mType = t;
|
||||
}
|
||||
|
||||
void ColorPeg::Reset()
|
||||
{
|
||||
SetIsDragged(false);
|
||||
setSelected(false);
|
||||
if (mPegRow != NULL)
|
||||
{
|
||||
mPegRow->RemovePeg(this);
|
||||
mPegRow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ColorPeg::SetIsDragged(bool b)
|
||||
{
|
||||
if (false == b)
|
||||
{
|
||||
update(boundingRect());
|
||||
}
|
||||
mIsDragged = b;
|
||||
}
|
||||
|
||||
void ColorPeg::SetEnabled(const bool b)
|
||||
{
|
||||
setEnabled(b);
|
||||
//setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
||||
SetCursorShape();
|
||||
}
|
||||
|
||||
void ColorPeg::SetCursorShape(Qt::CursorShape shape, const bool force)
|
||||
{
|
||||
if (!force)
|
||||
{
|
||||
if (mIsDragged)
|
||||
{
|
||||
shape = Qt::ClosedHandCursor;
|
||||
}
|
||||
else if (isEnabled())
|
||||
{
|
||||
shape = Qt::OpenHandCursor;
|
||||
}
|
||||
}
|
||||
if (cursor().shape() != shape)
|
||||
{
|
||||
setCursor(QCursor(shape));
|
||||
}
|
||||
}
|
||||
|
||||
QVariant ColorPeg::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemPositionHasChanged)
|
||||
{
|
||||
}
|
||||
else if (change == ItemPositionChange)
|
||||
{
|
||||
}
|
||||
else if (change == ItemFlagsChange)
|
||||
{
|
||||
}
|
||||
else if (change == ItemSelectedHasChanged)
|
||||
{
|
||||
scene()->update(scene()->sceneRect());
|
||||
}
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
void ColorPeg::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
if (mPegType != NULL)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
Reset();
|
||||
SetIsDragged(true);
|
||||
emit PegPressSignal(this);
|
||||
SetCursorShape();
|
||||
}
|
||||
}
|
||||
QGraphicsItem::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void ColorPeg::mouseReleaseEvent (QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
if (mPegType != NULL)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
SetIsDragged(false);
|
||||
emit PegReleasedSignal(this);
|
||||
SetCursorShape();
|
||||
}
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
QPainterPath ColorPeg::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addEllipse(boundingRect());
|
||||
return path;
|
||||
}
|
||||
|
||||
QRectF ColorPeg::boundingRect() const
|
||||
{
|
||||
int margin;
|
||||
if (mIsDragged)
|
||||
{
|
||||
margin = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
margin = 1;
|
||||
}
|
||||
return outlineRect().adjusted(-margin, -margin, +margin, +margin);
|
||||
}
|
||||
|
||||
QRectF ColorPeg::outlineRect() const
|
||||
{
|
||||
QRectF rect(0.0, 0.0, 36.0, 36.0);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void ColorPeg::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget* /* widget */)
|
||||
{
|
||||
/*
|
||||
QPen pen(Qt::red);
|
||||
pen.setWidth(2);
|
||||
if (option->state & QStyle::State_Selected)
|
||||
{
|
||||
pen.setStyle(Qt::DotLine);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (mIsDragged)
|
||||
{
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->translate(QPointF(-2, -2));
|
||||
painter->setBrush(ColorPeg::mShadowBrush);
|
||||
painter->drawEllipse(QRectF(0, 0, 44, 44));
|
||||
painter->translate(QPointF(2, 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen(ColorPeg::mPen);
|
||||
}
|
||||
|
||||
painter->setBrush(QBrush(mPegType->grad));
|
||||
painter->drawEllipse(outlineRect());
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
#ifndef COLORPEG_H
|
||||
#define COLORPEG_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
#include <QRadialGradient>
|
||||
#include <QGraphicsItem>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "mainwindow.h"
|
||||
#include "pegrow.h"
|
||||
#include "rowhint.h"
|
||||
|
||||
|
||||
class ColorPeg : public QObject, public QGraphicsItem
|
||||
{
|
||||
Q_OBJECT
|
||||
//Q_DECLARE_TR_FUNCTIONS(ColorPeg)
|
||||
|
||||
public:
|
||||
ColorPeg(QObject* parent = 0);
|
||||
~ColorPeg();
|
||||
|
||||
int mId;
|
||||
void SetId(int id);
|
||||
|
||||
void SetPegType(PegType* pt);
|
||||
void SetPegRow(PegRow* pr);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||
|
||||
void SetType(const int t);
|
||||
void SetEnabled(const bool b);
|
||||
void SetCursorShape( Qt::CursorShape shape = Qt::ArrowCursor, const bool force = false);
|
||||
PegType* GetPegType();
|
||||
int GetType() const;
|
||||
QColor GetPenColor() const;
|
||||
QColor GetBrushColor() const;
|
||||
|
||||
bool IsBtn() const;
|
||||
void SetBtn(bool b);
|
||||
void Reset();
|
||||
|
||||
signals:
|
||||
void PegReleasedSignal(ColorPeg* cp);
|
||||
void PegPressSignal(ColorPeg* cp);
|
||||
|
||||
protected:
|
||||
PegType* mPegType;
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent* e);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent* e);
|
||||
|
||||
private:
|
||||
static const QBrush mShadowBrush;
|
||||
static QBrush GetShadowBrush();
|
||||
static const QPen mPen;
|
||||
static QPen GetOutlinePen();
|
||||
|
||||
QRectF outlineRect() const;
|
||||
void SetIsDragged(bool b);
|
||||
|
||||
PegRow* mPegRow;
|
||||
|
||||
const QBrush mBrush;
|
||||
|
||||
int mType;
|
||||
bool mIsBtn;
|
||||
bool mIsDragged;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // COLORPEG_H
|
|
@ -1,492 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rev="made" href="mailto:webmasters@gnu.org" />
|
||||
<link rel="icon" type="image/png" href="/graphics/gnu-head-mini.png" />
|
||||
<meta name="ICBM" content="42.256233,-71.006581" />
|
||||
<meta name="DC.title" content="gnu.org" />
|
||||
<title>GNU General Public License v2.0 - GNU Project - Free Software Foundation (FSF)</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>GNU GENERAL PUBLIC LICENSE</h3>
|
||||
<p>
|
||||
Version 2, June 1991
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
</pre>
|
||||
|
||||
<h3>Preamble</h3>
|
||||
|
||||
<p>
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
</p>
|
||||
|
||||
|
||||
<h3>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h3>
|
||||
|
||||
|
||||
<p>
|
||||
<strong>0.</strong>
|
||||
This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>1.</strong>
|
||||
You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>2.</strong>
|
||||
You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<strong>a)</strong>
|
||||
You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
</dd>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<strong>b)</strong>
|
||||
You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
</dd>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<strong>c)</strong>
|
||||
If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>3.</strong>
|
||||
You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
</p>
|
||||
|
||||
<!-- we use this doubled UL to get the sub-sections indented, -->
|
||||
<!-- while making the bullets as unobvious as possible. -->
|
||||
|
||||
<dl>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<strong>a)</strong>
|
||||
Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
</dd>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<strong>b)</strong>
|
||||
Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
</dd>
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<strong>c)</strong>
|
||||
Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>4.</strong>
|
||||
You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>5.</strong>
|
||||
You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>6.</strong>
|
||||
Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>7.</strong>
|
||||
If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>8.</strong>
|
||||
If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>9.</strong>
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>10.</strong>
|
||||
If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
</p>
|
||||
|
||||
<p><strong>NO WARRANTY</strong></p>
|
||||
|
||||
<p>
|
||||
<strong>11.</strong>
|
||||
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>12.</strong>
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
</p>
|
||||
|
||||
<h3>END OF TERMS AND CONDITIONS</h3>
|
||||
|
||||
<h3>How to Apply These Terms to Your New Programs</h3>
|
||||
|
||||
<p>
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<var>one line to give the program's name and an idea of what it does.</var>
|
||||
Copyright (C) <var>yyyy</var> <var>name of author</var>
|
||||
|
||||
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 2
|
||||
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.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Gnomovision version 69, Copyright (C) <var>year</var> <var>name of author</var>
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||
type `show w'. This is free software, and you are welcome
|
||||
to redistribute it under certain conditions; type `show c'
|
||||
for details.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The hypothetical commands <samp>`show w'</samp> and <samp>`show c'</samp> should show
|
||||
the appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than <samp>`show w'</samp> and
|
||||
<samp>`show c'</samp>; they could even be mouse-clicks or menu items--whatever
|
||||
suits your program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
</p>
|
||||
|
||||
|
||||
<pre>
|
||||
Yoyodyne, Inc., hereby disclaims all copyright
|
||||
interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written
|
||||
by James Hacker.
|
||||
|
||||
<var>signature of Ty Coon</var>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the
|
||||
<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a>
|
||||
instead of this License.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef GAMEBOARD_H
|
||||
#define GAMEBOARD_H
|
||||
|
||||
#endif // GAMEBOARD_H
|
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 826 B |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 360 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 579 B |
Before Width: | Height: | Size: 802 B |
Before Width: | Height: | Size: 485 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 734 B |
Before Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 761 B |
Before Width: | Height: | Size: 931 B |
|
@ -1,71 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QLibraryInfo>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
string lang("");
|
||||
if (argc > 1)
|
||||
{
|
||||
string str;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
str = argv[i];
|
||||
if (str == "-h" || str == "--help")
|
||||
{
|
||||
cout << "usage: ColorCode [options]" << endl;
|
||||
cout << " options:" << endl;
|
||||
cout << " -l cc, --lang=cc use country code cc instead of system locale, accepted values for cc: en|de" << endl;
|
||||
cout << " -h, --help prints this message ;-)" << endl;
|
||||
return 0;
|
||||
}
|
||||
else if (str == "-l" && i < argc - 1)
|
||||
{
|
||||
if (std::string(argv[i + 1]) == "de" || std::string(argv[i + 1]) == "en")
|
||||
{
|
||||
std::string test(argv[i]);
|
||||
lang = argv[i + 1];
|
||||
}
|
||||
}
|
||||
else if ( str.size() == 9
|
||||
&& str.find("--lang=") != string::npos
|
||||
&& (str.substr(7) == "en" || str.substr(7) == "de") )
|
||||
{
|
||||
lang = str.substr(7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QTranslator qtTranslator;
|
||||
if (lang == "")
|
||||
{
|
||||
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
qtTranslator.load("qt_" + QString::fromStdString(lang), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
}
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator appTranslator;
|
||||
if (lang == "")
|
||||
{
|
||||
appTranslator.load("trans_" + QLocale::system().name());
|
||||
}
|
||||
else
|
||||
{
|
||||
appTranslator.load(":/trans_" + QString::fromStdString(lang));
|
||||
}
|
||||
app.installTranslator(&appTranslator);
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return app.exec();
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <iostream>
|
||||
#include <QMainWindow>
|
||||
|
||||
struct PegType
|
||||
{
|
||||
int ix;
|
||||
QRadialGradient grad;
|
||||
QColor pencolor;
|
||||
};
|
||||
|
||||
//typedef std::vector<PegType> TypesMap;
|
||||
|
||||
class QAction;
|
||||
class QActionGroup;
|
||||
class QComboBox;
|
||||
class QGraphicsItem;
|
||||
class QGraphicsTextItem;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsView;
|
||||
class ColorPeg;
|
||||
class PegRow;
|
||||
class RowHint;
|
||||
class Msg;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
static const int STATE_RUNNING;
|
||||
static const int STATE_WON;
|
||||
static const int STATE_LOST;
|
||||
static const int STATE_GAVE_UP;
|
||||
|
||||
static const int MAX_COLOR_CNT;
|
||||
static const int LEVEL_COLOR_CNTS[3];
|
||||
|
||||
int ROW_CNT;
|
||||
int POS_CNT;
|
||||
|
||||
public slots:
|
||||
void PegPressSlot(ColorPeg *cp);
|
||||
void PegReleasedSlot(ColorPeg *cp);
|
||||
void RowSolutionSlot(int ix);
|
||||
void HintPressedSlot(int ix);
|
||||
void ShowMsgSlot(QString msg);
|
||||
void RemovePegSlot(ColorPeg* cp);
|
||||
|
||||
protected :
|
||||
void resizeEvent(QResizeEvent* e);
|
||||
void contextMenuEvent(QContextMenuEvent* e);
|
||||
|
||||
private slots:
|
||||
void InitRows();
|
||||
void InitPegBtns();
|
||||
void NewGameSlot();
|
||||
void RestartGameSlot();
|
||||
void GiveInSlot();
|
||||
void ResetRows();
|
||||
void AboutSlot();
|
||||
void AboutQtSlot();
|
||||
void ShowToolbarSlot();
|
||||
void ShowMenubarSlot();
|
||||
void ShowStatusbarSlot();
|
||||
void SameColorSlot();
|
||||
void AutoCloseSlot();
|
||||
void ForceLevelSlot();
|
||||
|
||||
void RandRowSlot();
|
||||
void PrevRowSlot();
|
||||
void ClearRowSlot();
|
||||
|
||||
void LevelChangedSlot();
|
||||
|
||||
void UpdateRowMenuSlot();
|
||||
|
||||
void TestSlot();
|
||||
|
||||
private:
|
||||
enum Level { LEVEL_EASY,
|
||||
LEVEL_MEDIUM,
|
||||
LEVEL_HARD };
|
||||
|
||||
static Level mLevel;
|
||||
static int mColorCnt;
|
||||
static int mMaxZ;
|
||||
|
||||
int mGameState;
|
||||
|
||||
std::vector<int> mSolution;
|
||||
|
||||
QGraphicsScene* scene;
|
||||
QGraphicsView* view;
|
||||
QSize* mOrigSize;
|
||||
|
||||
Msg* mMsg;
|
||||
|
||||
PegRow* mCurRow;
|
||||
|
||||
std::vector<ColorPeg *> mPegBuff;
|
||||
PegRow* mSolRow;
|
||||
PegRow* mPegRows[10];
|
||||
RowHint* mHintBtns[10];
|
||||
|
||||
PegType* mTypesMap[10];
|
||||
ColorPeg* mPegBtns[10];
|
||||
ColorPeg* mSolPegs[4];
|
||||
QPoint mBtnPos[10];
|
||||
|
||||
void FillTypesMap();
|
||||
|
||||
void InitSolution();
|
||||
void InitActions();
|
||||
void InitMenus();
|
||||
void InitToolBars();
|
||||
|
||||
void SetLevel();
|
||||
void SetState(const int s);
|
||||
void NewGame();
|
||||
void SetSolution();
|
||||
void ShowSolution();
|
||||
void NextRow();
|
||||
void ResolveRow();
|
||||
void ResolveGame();
|
||||
void Scale();
|
||||
|
||||
ColorPeg* CreatePeg(int ix);
|
||||
void RemovePeg(ColorPeg* cp);
|
||||
|
||||
QMenu* GameMenu;
|
||||
QMenu* RowMenu;
|
||||
QMenu* SettingsMenu;
|
||||
QMenu* LevelMenu;
|
||||
QMenu* HelpMenu;
|
||||
QMenu* RowContextMenu;
|
||||
QToolBar* mGameToolbar;
|
||||
QToolBar* mLevelToolbar;
|
||||
|
||||
QComboBox* mLevelCmb;
|
||||
|
||||
QActionGroup* mLevelActions;
|
||||
QAction* NewGameAction;
|
||||
QAction* RestartGameAction;
|
||||
QAction* GiveInAction;
|
||||
QAction* ShowToolbarAction;
|
||||
QAction* ShowMenubarAction;
|
||||
QAction* ShowStatusbarAction;
|
||||
QAction* SameColorAction;
|
||||
QAction* AutoCloseAction;
|
||||
QAction* AboutAction;
|
||||
QAction* AboutQtAction;
|
||||
QAction* ExitAction;
|
||||
|
||||
QAction* mActLevelEasy;
|
||||
QAction* mActLevelMedium;
|
||||
QAction* mActLevelHard;
|
||||
|
||||
QAction* RandRowAction;
|
||||
QAction* PrevRowAction;
|
||||
QAction* ClearRowAction;
|
||||
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
|
@ -1,83 +0,0 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "msg.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Msg::Msg()
|
||||
{
|
||||
/*
|
||||
setFont(QFont("Arial", 14, QFont::Bold, false));
|
||||
setDefaultTextColor(QColor("#cccccc"));
|
||||
setTextWidth(300);
|
||||
|
||||
mTd = new QTextDocument();
|
||||
mTd->setDefaultFont(QFont("Arial", 14, QFont::Bold, false));
|
||||
mTd->setTextWidth(300);
|
||||
|
||||
|
||||
//QAbstractTextDocumentLayout* lay = mTd->documentLayout();
|
||||
|
||||
setDocument(mTd);
|
||||
*/
|
||||
mFont = QFont("Arial", 14, QFont::Bold, false);
|
||||
mFont.setStyleHint(QFont::SansSerif);
|
||||
mLay = new QTextLayout();
|
||||
mLay->setFont(mFont);
|
||||
mLay->setTextOption(QTextOption(Qt::AlignHCenter));
|
||||
mUpdateRect = QRectF(0, 0, 10, 10);
|
||||
}
|
||||
|
||||
Msg::~Msg()
|
||||
{
|
||||
}
|
||||
|
||||
void Msg::ShowMsg(const QString str)
|
||||
{
|
||||
//setPlainText(str);
|
||||
//mTd->clear();
|
||||
//mTd->setPlainText(str);
|
||||
mUpdateRect = boundingRect();
|
||||
|
||||
mLay->setText(str);
|
||||
int leading = -3;//fontMetrics.leading();
|
||||
qreal h = 10;
|
||||
qreal maxw = 0;
|
||||
qreal maxh = 0;
|
||||
mLay->beginLayout();
|
||||
|
||||
while (1)
|
||||
{
|
||||
QTextLine line = mLay->createLine();
|
||||
if (!line.isValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
line.setLineWidth(280);
|
||||
h += leading;
|
||||
line.setPosition(QPointF(0, h));
|
||||
h += line.height();
|
||||
maxw = qMax(maxw, line.naturalTextWidth());
|
||||
}
|
||||
mLay->endLayout();
|
||||
|
||||
|
||||
maxw = qMax(mUpdateRect.width(), mLay->boundingRect().width());
|
||||
maxh = qMax(mUpdateRect.height(), mLay->boundingRect().height() + 8);
|
||||
mUpdateRect = QRectF(0, 0, maxw, maxh);
|
||||
|
||||
update(boundingRect());
|
||||
}
|
||||
|
||||
QRectF Msg::boundingRect() const
|
||||
{
|
||||
return mUpdateRect;
|
||||
}
|
||||
|
||||
void Msg::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
||||
{
|
||||
//painter->setBrush(Qt::NoBrush);
|
||||
painter->setPen(QPen(QColor("#f0f0f0")));
|
||||
mLay->draw(painter, QPoint(0, 0));
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
#ifndef MSG_H
|
||||
#define MSG_H
|
||||
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QFont>
|
||||
#include <QTextDocument>
|
||||
#include <QTextBlock>
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <iostream>
|
||||
|
||||
class Msg : public QGraphicsTextItem
|
||||
{
|
||||
public:
|
||||
Msg();
|
||||
~Msg();
|
||||
|
||||
void ShowMsg(const QString str);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||
|
||||
private:
|
||||
/*
|
||||
QTextDocument* mTd;
|
||||
QTextBlock mTb;
|
||||
*/
|
||||
QTextLayout* mLay;
|
||||
QFont mFont;
|
||||
QRectF mUpdateRect;
|
||||
};
|
||||
|
||||
#endif // MSG_H
|
|
@ -1,238 +0,0 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "colorpeg.h"
|
||||
#include "pegrow.h"
|
||||
#include "rowhint.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
PegRow::PegRow(QObject*)
|
||||
{
|
||||
mIx = -1;
|
||||
|
||||
//setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
||||
|
||||
mPen = QPen(QColor("#808080"));
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
mColorPegs[i] = NULL;
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
PegRow::~PegRow()
|
||||
{
|
||||
}
|
||||
|
||||
void PegRow::Reset()
|
||||
{
|
||||
ClearRow();
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
void PegRow::ClearRow()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (mColorPegs[i] != NULL)
|
||||
{
|
||||
emit(RemovePegSignal(mColorPegs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PegRow::GetIx() const
|
||||
{
|
||||
return mIx;
|
||||
}
|
||||
|
||||
void PegRow::SetIx(const int ix)
|
||||
{
|
||||
mIx = ix;
|
||||
}
|
||||
|
||||
int PegRow::GetPegCnt()
|
||||
{
|
||||
int cnt = 0;
|
||||
int i = 0;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
if (mColorPegs[i] != NULL)
|
||||
{
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
ColorPeg** PegRow::GetPegs()
|
||||
{
|
||||
return mColorPegs;
|
||||
}
|
||||
|
||||
void PegRow::SetActive(const bool b)
|
||||
{
|
||||
mIsActive = b;
|
||||
if (b)
|
||||
{
|
||||
setOpacity(1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
setOpacity(0.5);
|
||||
}
|
||||
update(boundingRect());
|
||||
}
|
||||
|
||||
bool PegRow::SnapCP(ColorPeg *cp)
|
||||
{
|
||||
|
||||
bool snapped = false;
|
||||
if (mIsActive)
|
||||
{
|
||||
QPointF p = mapFromParent(cp->pos());
|
||||
|
||||
p.rx() += 18;
|
||||
p.ry() += 18;
|
||||
|
||||
int ix = -1;
|
||||
int i;
|
||||
|
||||
if (p.y() >= 0 && p.y() <= 40)
|
||||
{
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
if (p.x() >= i * 40 && p.x() < (i + 1) * 40)
|
||||
{
|
||||
if (mColorPegs[i] != NULL)
|
||||
{
|
||||
emit RemovePegSignal(mColorPegs[i]);
|
||||
mColorPegs[i] = NULL;
|
||||
}
|
||||
mColorPegs[i] = cp;
|
||||
cp->SetPegRow(this);
|
||||
ix = i;
|
||||
cp->setPos(mapToParent(i * 40 + 2, 2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snapped = ix > -1;
|
||||
CheckSolution();
|
||||
}
|
||||
|
||||
return snapped;
|
||||
}
|
||||
|
||||
void PegRow::ForceSnap(ColorPeg* cp, int posix)
|
||||
{
|
||||
if (mIsActive)
|
||||
{
|
||||
if (mColorPegs[posix] != NULL)
|
||||
{
|
||||
emit RemovePegSignal(mColorPegs[posix]);
|
||||
mColorPegs[posix] = NULL;
|
||||
}
|
||||
mColorPegs[posix] = cp;
|
||||
cp->SetPegRow(this);
|
||||
cp->setPos(mapToParent(posix * 40 + 2, 2));
|
||||
|
||||
CheckSolution();
|
||||
}
|
||||
}
|
||||
|
||||
void PegRow::CloseRow()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (mColorPegs[i] != NULL)
|
||||
{
|
||||
mColorPegs[i]->SetEnabled(false);
|
||||
}
|
||||
}
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
void PegRow::CheckSolution()
|
||||
{
|
||||
mSolution.clear();
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (mColorPegs[i] != NULL)
|
||||
{
|
||||
//mColorPegs[i]->setEnabled(false);
|
||||
//mColorPegs[i]->setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
||||
mSolution.push_back(mColorPegs[i]->GetPegType()->ix);
|
||||
}
|
||||
}
|
||||
|
||||
emit RowSolutionSignal(mIx);
|
||||
}
|
||||
|
||||
std::vector<int> PegRow::GetSolution() const
|
||||
{
|
||||
return mSolution;
|
||||
}
|
||||
|
||||
void PegRow::RemovePeg(ColorPeg *cp)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (mColorPegs[i] == cp)
|
||||
{
|
||||
mColorPegs[i] = NULL;
|
||||
if (mIsActive)
|
||||
{
|
||||
CheckSolution();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariant PegRow::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
QPainterPath PegRow::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addRect(boundingRect());
|
||||
return path;
|
||||
}
|
||||
|
||||
QRectF PegRow::boundingRect() const
|
||||
{
|
||||
const int Margin = 1;
|
||||
return outlineRect().adjusted(-Margin, -Margin, +Margin, +Margin);
|
||||
}
|
||||
|
||||
QRectF PegRow::outlineRect() const
|
||||
{
|
||||
return QRectF(0.0, 0.0, 160.0, 40.0);
|
||||
}
|
||||
|
||||
void PegRow::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* /* widget */)
|
||||
{
|
||||
mPen.setWidth(2);
|
||||
if (option->state & QStyle::State_Selected)
|
||||
{
|
||||
mPen.setStyle(Qt::DotLine);
|
||||
}
|
||||
|
||||
painter->setPen(mPen);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
QRadialGradient grad(QPointF(i * 40 + 10, 10), 100);
|
||||
grad.setColorAt(0, QColor("#cccccc"));
|
||||
grad.setColorAt(1, QColor("#ffffff"));
|
||||
painter->setBrush(QBrush(grad));
|
||||
painter->drawRect(QRectF(i * 40, 0.0, 40.0, 40.0));
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
#ifndef PEGROW_H
|
||||
#define PEGROW_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
#include <QRadialGradient>
|
||||
#include <QGraphicsItem>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "mainwindow.h"
|
||||
#include "pegrow.h"
|
||||
#include "colorpeg.h"
|
||||
|
||||
class PegRow : public QObject, public QGraphicsItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PegRow(QObject* parent = 0);
|
||||
~PegRow();
|
||||
|
||||
int GetIx() const;
|
||||
int GetPegCnt();
|
||||
ColorPeg** GetPegs();
|
||||
std::vector<int> GetSolution() const;
|
||||
void SetIx(const int ix);
|
||||
void SetActive(const bool b);
|
||||
bool SnapCP(ColorPeg* cp);
|
||||
void ForceSnap(ColorPeg* cp, int posix);
|
||||
void RemovePeg(ColorPeg* cp);
|
||||
|
||||
void CloseRow();
|
||||
void ClearRow();
|
||||
void Reset();
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
|
||||
signals:
|
||||
void RowSolutionSignal(int ix);
|
||||
void RemovePegSignal(ColorPeg* cp);
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
//void contextMenuEvent(QGraphicsSceneContextMenuEvent* e);
|
||||
|
||||
private slots:
|
||||
//void FillRandSlot();
|
||||
|
||||
private:
|
||||
std::vector<int> mSolution;
|
||||
QPen mPen;
|
||||
bool mIsActive;
|
||||
int mIx;
|
||||
|
||||
void CheckSolution();
|
||||
ColorPeg* mColorPegs[4];
|
||||
QRectF outlineRect() const;
|
||||
/*
|
||||
void InitActions();
|
||||
void InitMenus();
|
||||
QAction* FillRandAct;
|
||||
QAction* ClearRowAct;
|
||||
QMenu* ContextMenu;
|
||||
*/
|
||||
};
|
||||
|
||||
#endif // PEGROW_H
|
|
@ -1,25 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>docs/GPL.html</file>
|
||||
<file>img/application-exit.png</file>
|
||||
<file>img/document-new.png</file>
|
||||
<file>img/GNU-icon16.png</file>
|
||||
<file>img/GNU-icon32.png</file>
|
||||
<file>img/GNU-icon64.png</file>
|
||||
<file>img/GNU-icon.png</file>
|
||||
<file>img/help-about.png</file>
|
||||
<file>img/qt.png</file>
|
||||
<file>img/story-editor.png</file>
|
||||
<file>img/view-refresh.png</file>
|
||||
<file>img/bm03.png</file>
|
||||
<file>trans_de.qm</file>
|
||||
<file>img/face-sad.png</file>
|
||||
<file>img/edit-clear.png</file>
|
||||
<file>img/edit-copy.png</file>
|
||||
<file>img/system-switch-user.png</file>
|
||||
<file>img/cc16.png</file>
|
||||
<file>img/cc32.png</file>
|
||||
<file>img/cc64.png</file>
|
||||
<file>cc32.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,154 +0,0 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "rowhint.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
RowHint::RowHint(QObject*)
|
||||
{
|
||||
//setFlags(QGraphicsItem::GraphicsItemFlags(0));
|
||||
|
||||
mIx = -1;
|
||||
|
||||
mPen = QPen(QColor("#808080"));
|
||||
mPen.setWidth(2);
|
||||
|
||||
QRadialGradient grad(QPointF(10, 10), 100);
|
||||
grad.setColorAt(0, QColor("#d8d8d8"));
|
||||
grad.setColorAt(1, QColor("#ffffff"));
|
||||
mBrush1 = QBrush(grad);
|
||||
grad.setColorAt(0, QColor(216, 216, 216, 51));
|
||||
grad.setColorAt(1, QColor(255, 255, 255, 51));
|
||||
mBrush0 = QBrush(grad);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
RowHint::~RowHint()
|
||||
{
|
||||
scene()->removeItem(this);
|
||||
}
|
||||
|
||||
void RowHint::Reset()
|
||||
{
|
||||
mActive = true;
|
||||
mHints.clear();
|
||||
mSolved = false;
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
int RowHint::GetIx() const
|
||||
{
|
||||
return mIx;
|
||||
}
|
||||
|
||||
void RowHint::SetIx(const int ix)
|
||||
{
|
||||
mIx = ix;
|
||||
}
|
||||
|
||||
void RowHint::SetActive(bool b)
|
||||
{
|
||||
if (b == mActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mActive = b;
|
||||
setAcceptHoverEvents(b);
|
||||
setEnabled(b);
|
||||
if (b)
|
||||
{
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
//setOpacity(1);
|
||||
setToolTip(tr("Commit Your solution"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
//setOpacity(0.2);
|
||||
setToolTip(QString(""));
|
||||
}
|
||||
//scene()->update(mapRectToScene(boundingRect()));
|
||||
update(boundingRect());
|
||||
}
|
||||
|
||||
void RowHint::DrawHints(std::vector<int> res)
|
||||
{
|
||||
mHints = res;
|
||||
mSolved = true;
|
||||
for (unsigned i = 0; i < mHints.size(); ++i)
|
||||
{
|
||||
}
|
||||
update(boundingRect());
|
||||
}
|
||||
|
||||
void RowHint::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
if (mActive && !mSolved)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
{
|
||||
SetActive(false);
|
||||
emit HintPressedSignal(mIx);
|
||||
}
|
||||
}
|
||||
QGraphicsItem::mousePressEvent(e);
|
||||
}
|
||||
|
||||
QPainterPath RowHint::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addRect(boundingRect());
|
||||
return path;
|
||||
}
|
||||
|
||||
QRectF RowHint::boundingRect() const
|
||||
{
|
||||
const int Margin = 1;
|
||||
return outlineRect().adjusted(-Margin, -Margin, +Margin, +Margin);
|
||||
}
|
||||
|
||||
QRectF RowHint::outlineRect() const
|
||||
{
|
||||
return QRectF(0.0, 0.0, 40.0, 40.0);
|
||||
}
|
||||
|
||||
void RowHint::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /* widget */)
|
||||
{
|
||||
painter->setPen(mPen);
|
||||
if (mActive)
|
||||
{
|
||||
painter->setBrush(mBrush1);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setBrush(mBrush0);
|
||||
}
|
||||
|
||||
QPainterPath path;
|
||||
path.addRect(QRectF(0.0, 0.0, 40.0, 40.0));
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
//painter->drawEllipse(QRect((i % 2) * 16 + 6, floor(i / 2) * 16 + 6, 12, 12));
|
||||
path.addEllipse(QRectF((i % 2) * 16 + 6, floor(i / 2) * 16 + 6, 12, 12));
|
||||
}
|
||||
//painter->drawRect(QRectF(0.0, 0.0, 40.0, 40.0));
|
||||
painter->drawPath(path);
|
||||
|
||||
if (mSolved)
|
||||
{
|
||||
for (unsigned i = 0; i < mHints.size(); i++)
|
||||
{
|
||||
if (mHints.at(i) == 2)
|
||||
{
|
||||
painter->setBrush(QBrush(Qt::black));
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setBrush(QBrush(Qt::white));
|
||||
}
|
||||
painter->drawEllipse(QRectF((i % 2) * 16 + 6, floor(i / 2) * 16 + 6, 12, 12));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
#ifndef ROWHINT_H
|
||||
#define ROWHINT_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
#include <QRadialGradient>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "mainwindow.h"
|
||||
|
||||
class RowHint : public QObject, public QGraphicsItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RowHint(QObject* parent = 0);
|
||||
~RowHint();
|
||||
|
||||
int mIx;
|
||||
bool mActive;
|
||||
bool mSolved;
|
||||
std::vector<int> mHints;
|
||||
|
||||
int GetIx() const;
|
||||
void SetIx(const int ix);
|
||||
void SetActive(bool b);
|
||||
void DrawHints(std::vector<int> res);
|
||||
void Reset();
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
|
||||
signals:
|
||||
void HintPressedSignal(int ix);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent* e);
|
||||
|
||||
private:
|
||||
QPen mPen;
|
||||
QBrush mBrush0;
|
||||
QBrush mBrush1;
|
||||
|
||||
QRectF outlineRect() const;
|
||||
};
|
||||
|
||||
#endif // ROWHINT_H
|
|
@ -1,250 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="de_DE">
|
||||
<defaultcodec>UTF-8</defaultcodec>
|
||||
<context>
|
||||
<name>About</name>
|
||||
<message>
|
||||
<source>&Author</source>
|
||||
<translation>&Autor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>icon</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&License</source>
|
||||
<translation>&Lizenz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A needful game to train your brain ;-)</source>
|
||||
<translation>Ein Spiel, um den Verstand<br>wachzuhalten ;-)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>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 2 of the License, or (at your option) any later version.</source>
|
||||
<translation> Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder späteren Version.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ColorCode</source>
|
||||
<translation>ColorCode</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About ColorCode</source>
|
||||
<translation>Info ColorCode</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<source>New Game</source>
|
||||
<translation>Neues Spiel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you want to give in
|
||||
and start a new Game?</source>
|
||||
<translation>Wollen Sie aufgeben und
|
||||
ein neues Spiel beginnen?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About Qt</source>
|
||||
<translation>Info Qt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&New Game</source>
|
||||
<translation>&Neues Spiel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+N</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Restart Game</source>
|
||||
<translation>Spiel neu &beginnen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+R</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>E&xit</source>
|
||||
<translation>B&eenden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Q</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+T</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+C</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+4</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+A</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About &Qt</source>
|
||||
<translation>Info &Qt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Game</source>
|
||||
<translation>&Spiel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Settings</source>
|
||||
<translation>&Einstellungen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Help</source>
|
||||
<translation>&Hilfe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Game</source>
|
||||
<translation>Spiel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message</source>
|
||||
<translation>Hinweis</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The changed settings will only apply to new games!
|
||||
Do you want to give in the current and start a new Game?</source>
|
||||
<translation>Die geänderten Einstellungen werden erst in neuen Spielen berücksichtigt!
|
||||
Möchten Sie das gegenwärtige Spiel aufgeben und ein neues Spiel beginnen?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press the Hint Field if You're done.</source>
|
||||
<translation>Fertig? Dann klicken Sie auf das Hinweis-Feld.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Place Your pegs ...</source>
|
||||
<translation>Setzen Sie Ihre Steine ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Congratulation! You have won!</source>
|
||||
<translation>Glückwunsch! Sie haben gewonnen!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry! You lost!</source>
|
||||
<translation>Schade, aber Sie haben es nicht vermocht!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+I</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Give In</source>
|
||||
<translation>Aufgeben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you really want to give in?</source>
|
||||
<translation>Wollen Sie wirklich aufgeben?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Throw In The Towel</source>
|
||||
<translation>&Handtuch werfen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+G</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sure, You're too weak for me!</source>
|
||||
<translation>Klar, Sie sind zu schwach für mich!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Shift+R</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Shift+C</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fill Row by Random</source>
|
||||
<translation>Reihe zufällig füllen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Duplicate Previous Row</source>
|
||||
<translation>Vorherige Reihe duplizieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+D</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear Row</source>
|
||||
<translation>Reihe leeren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Row</source>
|
||||
<translation>&Reihe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ColorCode</source>
|
||||
<translation>ColorCode</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About &ColorCode</source>
|
||||
<translation>Info &ColorCode</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+M</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+S</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Easy - 6 Colors</source>
|
||||
<translation>Leicht - 6 Farben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Medium - 8 Colors</source>
|
||||
<translation>Mittel - 8 Farben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hard - 10 Colors</source>
|
||||
<translation>Schwer - 10 Farben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Toolbar</source>
|
||||
<translation>Toolbar anzeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Menubar</source>
|
||||
<translation>Menüleiste anzeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Statusbar</source>
|
||||
<translation>Statusleiste anzeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Allow Pegs of the Same Color</source>
|
||||
<translation>Steine gleicher Farbe erlauben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close Rows when the 4th Peg is placed</source>
|
||||
<translation>Reihen nach Setzen des 4. Steins auswerten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Level</source>
|
||||
<translation>Schwierigkeitsgrad</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RowHint</name>
|
||||
<message>
|
||||
<source>Commit Your solution</source>
|
||||
<translation>Kombination testen</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -1,248 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0">
|
||||
<defaultcodec>UTF-8</defaultcodec>
|
||||
<context>
|
||||
<name>About</name>
|
||||
<message>
|
||||
<source>&Author</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>icon</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&License</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A needful game to train your brain ;-)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>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 2 of the License, or (at your option) any later version.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ColorCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About ColorCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<source>New Game</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you want to give in
|
||||
and start a new Game?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About Qt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&New Game</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+N</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Restart Game</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+R</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>E&xit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Q</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+T</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+C</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+4</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+A</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About &Qt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Game</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Help</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Game</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The changed settings will only apply to new games!
|
||||
Do you want to give in the current and start a new Game?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press the Hint Field if You're done.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Place Your pegs ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Congratulation! You have won!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sorry! You lost!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+I</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Give In</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you really want to give in?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Throw In The Towel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+G</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sure, You're too weak for me!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Shift+R</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+Shift+C</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fill Row by Random</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Duplicate Previous Row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+D</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear Row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ColorCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About &ColorCode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+M</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+S</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Easy - 6 Colors</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Medium - 8 Colors</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hard - 10 Colors</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Toolbar</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Menubar</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Statusbar</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Allow Pegs of the Same Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close Rows when the 4th Peg is placed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Level</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RowHint</name>
|
||||
<message>
|
||||
<source>Commit Your solution</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
|
@ -1,264 +0,0 @@
|
|||
//! [0]
|
||||
function Plugin(ui)
|
||||
{
|
||||
this.ui = ui;
|
||||
|
||||
this.pendingAdditiveOperator = "";
|
||||
this.pendingMultiplicativeOperator = "";
|
||||
this.sumInMemory = 0;
|
||||
this.sumSoFar = 0;
|
||||
this.factorSoFar = 0;
|
||||
this.waitingForOperand = true;
|
||||
|
||||
with (ui) {
|
||||
display.text = "0";
|
||||
|
||||
zeroButton.clicked.connect(this, this.digitClicked);
|
||||
oneButton.clicked.connect(this, "digitClicked");
|
||||
twoButton.clicked.connect(this, "digitClicked");
|
||||
threeButton.clicked.connect(this, "digitClicked");
|
||||
fourButton.clicked.connect(this, "digitClicked");
|
||||
fiveButton.clicked.connect(this, "digitClicked");
|
||||
sixButton.clicked.connect(this, "digitClicked");
|
||||
sevenButton.clicked.connect(this, "digitClicked");
|
||||
eightButton.clicked.connect(this, "digitClicked");
|
||||
nineButton.clicked.connect(this, "digitClicked");
|
||||
|
||||
pointButton.clicked.connect(this, "pointClicked");
|
||||
changeSignButton.clicked.connect(this, "changeSignClicked");
|
||||
|
||||
backspaceButton.clicked.connect(this, "backspaceClicked");
|
||||
clearButton.clicked.connect(this, "clear");
|
||||
clearAllButton.clicked.connect(this, "clearAll");
|
||||
|
||||
clearMemoryButton.clicked.connect(this, "clearMemory");
|
||||
readMemoryButton.clicked.connect(this, "readMemory");
|
||||
setMemoryButton.clicked.connect(this, "setMemory");
|
||||
addToMemoryButton.clicked.connect(this, "addToMemory");
|
||||
|
||||
divisionButton.clicked.connect(this, "multiplicativeOperatorClicked");
|
||||
timesButton.clicked.connect(this, "multiplicativeOperatorClicked");
|
||||
minusButton.clicked.connect(this, "additiveOperatorClicked");
|
||||
plusButton.clicked.connect(this, "additiveOperatorClicked");
|
||||
|
||||
squareRootButton.clicked.connect(this, "unaryOperatorClicked");
|
||||
powerButton.clicked.connect(this, "unaryOperatorClicked");
|
||||
reciprocalButton.clicked.connect(this, "unaryOperatorClicked");
|
||||
equalButton.clicked.connect(this, "equalClicked");
|
||||
}
|
||||
}
|
||||
//! [0]
|
||||
|
||||
Plugin.prototype.abortOperation = function()
|
||||
{
|
||||
this.clearAll();
|
||||
this.ui.display.text = "####";
|
||||
}
|
||||
|
||||
Plugin.prototype.calculate = function(rightOperand, pendingOperator)
|
||||
{
|
||||
if (pendingOperator == "+") {
|
||||
this.sumSoFar += rightOperand;
|
||||
} else if (pendingOperator == "-") {
|
||||
this.sumSoFar -= rightOperand;
|
||||
} else if (pendingOperator == "*") {
|
||||
this.factorSoFar *= rightOperand;
|
||||
} else if (pendingOperator == "/") {
|
||||
if (rightOperand == 0)
|
||||
return false;
|
||||
this.factorSoFar /= rightOperand;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//! [1]
|
||||
Plugin.prototype.digitClicked = function()
|
||||
{
|
||||
var digitValue = __qt_sender__.text - 0;
|
||||
if ((digitValue == 0) && (this.ui.display.text == "0"))
|
||||
return;
|
||||
if (this.waitingForOperand) {
|
||||
this.ui.display.clear();
|
||||
this.waitingForOperand = false;
|
||||
}
|
||||
this.ui.display.text += digitValue;
|
||||
}
|
||||
//! [1]
|
||||
|
||||
Plugin.prototype.unaryOperatorClicked = function()
|
||||
{
|
||||
var operand = this.ui.display.text - 0;
|
||||
var result = 0;
|
||||
if (__qt_sender__.text == "Sqrt") {
|
||||
if (operand < 0) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
result = Math.sqrt(operand);
|
||||
} else if (__qt_sender__.text == "x^2") {
|
||||
result = Math.pow(operand, 2);
|
||||
} else if (__qt_sender__.text == "1/x") {
|
||||
if (operand == 0.0) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
result = 1 / operand;
|
||||
}
|
||||
this.ui.display.text = result + "";
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.additiveOperatorClicked = function()
|
||||
{
|
||||
var operand = this.ui.display.text - 0;
|
||||
|
||||
if (this.pendingMultiplicativeOperator.length != 0) {
|
||||
if (!this.calculate(operand, this.pendingMultiplicativeOperator)) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
this.ui.display.text = this.factorSoFar + "";
|
||||
operand = this.factorSoFar;
|
||||
this.factorSoFar = 0;
|
||||
this.pendingMultiplicativeOperator = "";
|
||||
}
|
||||
|
||||
if (this.pendingAdditiveOperator.length != 0) {
|
||||
if (!this.calculate(operand, this.pendingAdditiveOperator)) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
this.ui.display.text = this.sumSoFar + "";
|
||||
} else {
|
||||
this.sumSoFar = operand;
|
||||
}
|
||||
|
||||
this.pendingAdditiveOperator = __qt_sender__.text;
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.multiplicativeOperatorClicked = function()
|
||||
{
|
||||
var operand = this.ui.display.text - 0;
|
||||
|
||||
if (this.pendingMultiplicativeOperator.length != 0) {
|
||||
if (!this.calculate(operand, this.pendingMultiplicativeOperator)) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
this.ui.display.text = this.factorSoFar + "";
|
||||
} else {
|
||||
this.factorSoFar = operand;
|
||||
}
|
||||
|
||||
this.pendingMultiplicativeOperator = __qt_sender__.text;
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.equalClicked = function()
|
||||
{
|
||||
var operand = this.ui.display.text - 0;
|
||||
|
||||
if (this.pendingMultiplicativeOperator.length != 0) {
|
||||
if (!this.calculate(operand, this.pendingMultiplicativeOperator)) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
operand = this.factorSoFar;
|
||||
this.factorSoFar = 0.0;
|
||||
this.pendingMultiplicativeOperator = "";
|
||||
}
|
||||
if (this.pendingAdditiveOperator.length != 0) {
|
||||
if (!this.calculate(operand, this.pendingAdditiveOperator)) {
|
||||
this.abortOperation();
|
||||
return;
|
||||
}
|
||||
this.pendingAdditiveOperator = "";
|
||||
} else {
|
||||
this.sumSoFar = operand;
|
||||
}
|
||||
|
||||
this.ui.display.text = this.sumSoFar + "";
|
||||
this.sumSoFar = 0.0;
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.pointClicked = function()
|
||||
{
|
||||
if (this.waitingForOperand)
|
||||
this.ui.display.text = "0";
|
||||
if (this.ui.display.text.indexOf(".") == -1)
|
||||
this.ui.display.text += ".";
|
||||
this.waitingForOperand = false;
|
||||
}
|
||||
|
||||
//! [2]
|
||||
Plugin.prototype.changeSignClicked = function()
|
||||
{
|
||||
var text = this.ui.display.text;
|
||||
var value = text - 0;
|
||||
|
||||
if (value > 0) {
|
||||
text = "-" + text;
|
||||
} else if (value < 0) {
|
||||
text = text.slice(1);
|
||||
}
|
||||
this.ui.display.text = text;
|
||||
}
|
||||
//! [2]
|
||||
|
||||
Plugin.prototype.backspaceClicked = function()
|
||||
{
|
||||
if (this.waitingForOperand)
|
||||
return;
|
||||
|
||||
var text = this.ui.display.text;
|
||||
text = text.slice(0, -1);
|
||||
if (text.length == 0) {
|
||||
text = "0";
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
this.ui.display.text = text;
|
||||
}
|
||||
|
||||
Plugin.prototype.clear = function()
|
||||
{
|
||||
if (this.waitingForOperand)
|
||||
return;
|
||||
|
||||
this.ui.display.text = "0";
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.clearAll = function()
|
||||
{
|
||||
this.sumSoFar = 0.0;
|
||||
this.factorSoFar = 0.0;
|
||||
this.pendingAdditiveOperator = "";
|
||||
this.pendingMultiplicativeOperator = "";
|
||||
this.ui.display.text = "0";
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.clearMemory = function()
|
||||
{
|
||||
this.sumInMemory = 0.0;
|
||||
}
|
||||
|
||||
Plugin.prototype.readMemory = function()
|
||||
{
|
||||
this.ui.display.text = this.sumInMemory + "";
|
||||
this.waitingForOperand = true;
|
||||
}
|
||||
|
||||
Plugin.prototype.setMemory = function()
|
||||
{
|
||||
this.equalClicked();
|
||||
this.sumInMemory = this.ui.display.text - 0;
|
||||
}
|
||||
|
||||
Plugin.prototype.addToMemory = function()
|
||||
{
|
||||
this.equalClicked();
|
||||
this.sumInMemory += this.ui.display.text - 0;
|
||||
}
|
|
@ -1,406 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>Calculator</class>
|
||||
<widget class="QWidget" name="Calculator" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>314</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>314</width>
|
||||
<height>301</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>314</width>
|
||||
<height>301</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Calculator</string>
|
||||
</property>
|
||||
<widget class="QToolButton" name="backspaceButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>91</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Backspace</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="clearButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>50</y>
|
||||
<width>91</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Clear :)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="clearAllButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>50</y>
|
||||
<width>91</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Clear All</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="clearMemoryButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>MC</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="readMemoryButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>MR</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="setMemoryButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>MS</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="addToMemoryButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>250</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>M+</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="sevenButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>7</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="eightButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>8</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="nineButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>9</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="fourButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="fiveButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="sixButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>6</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="oneButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="twoButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="threeButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="zeroButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>250</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="pointButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>250</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="changeSignButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>250</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>+-</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="plusButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>250</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="divisionButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>/</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="timesButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>*</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="minusButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="squareRootButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>100</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Sqrt</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="powerButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>150</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>x^2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="reciprocalButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>1/x</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="equalButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>250</y>
|
||||
<width>41</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>=</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="display" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>291</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maxLength" >
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,28 +0,0 @@
|
|||
#=== this part is common (similar) for all plugin projects =====================
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin debug
|
||||
|
||||
# this is directory, where PluginInterface.h is located
|
||||
INCLUDEPATH += ../
|
||||
|
||||
# and, the result (*.so or *.dll) should appear in this directory
|
||||
DESTDIR = ../bin
|
||||
OBJECTS_DIR = temp/obj
|
||||
RCC_DIR = temp/qrc
|
||||
UI_DIR = temp/ui
|
||||
MOC_DIR = temp/moc
|
||||
|
||||
|
||||
# the name of the result file;
|
||||
TARGET = $$qtLibraryTarget(calendar_plugin)
|
||||
|
||||
HEADERS += ../PluginInterface.h \
|
||||
src/CalendarPlugin.h
|
||||
SOURCES += src/CalendarPlugin.cpp
|
||||
|
||||
#===============================================================================
|
||||
|
||||
#=== and this are definitions, specific for this program =======================
|
||||
HEADERS += src/mainwindow.h
|
||||
SOURCES += src/mainwindow.cpp
|
||||
#===============================================================================
|
|
@ -1,33 +0,0 @@
|
|||
//#include <QApplication>
|
||||
//#include <QString>
|
||||
//#include <QPushButton>
|
||||
|
||||
#include "CalendarPlugin.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
QString
|
||||
CalendarPlugin::pluginDescription() const
|
||||
{
|
||||
QString res;
|
||||
res = "A simple plugin, based on QT calendar(richtext) example" ;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QString
|
||||
CalendarPlugin::pluginName() const
|
||||
{
|
||||
return "Calendar" ;
|
||||
}
|
||||
|
||||
QWidget*
|
||||
CalendarPlugin::pluginWidget(QWidget * parent )
|
||||
{
|
||||
MainWindow* window = new MainWindow(parent);
|
||||
//window->openImage(":/images/example.jpg");
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2(calendar_plugin, CalendarPlugin)
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef _HWA_PLUGIN_H_
|
||||
#define _HWA_PLUGIN_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <PluginInterface.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class CalendarPlugin: public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
public slots:
|
||||
|
||||
virtual QString pluginDescription() const ;
|
||||
virtual QString pluginName() const ;
|
||||
|
||||
virtual QWidget* pluginWidget(QWidget * parent = 0) ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,213 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the example classes of the Qt Toolkit.
|
||||
**
|
||||
** 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 General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License versions 2.0 or 3.0 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information
|
||||
** to ensure GNU General Public Licensing requirements will be met:
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
||||
** exception, Nokia gives you certain additional rights. These rights
|
||||
** are described in the Nokia Qt GPL Exception version 1.3, included in
|
||||
** the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Qt for Windows(R) Licensees
|
||||
** As a special exception, Nokia, as the sole copyright holder for Qt
|
||||
** Designer, grants users of the Qt/Eclipse Integration plug-in the
|
||||
** right for the Qt/Eclipse Integration to link to functionality
|
||||
** provided by Qt Designer and its related libraries.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
//! [0]
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
:QFrame(parent)
|
||||
{
|
||||
selectedDate = QDate::currentDate();
|
||||
fontSize = 10;
|
||||
|
||||
// QWidget *centralWidget = new QWidget;
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
QLabel *dateLabel = new QLabel(tr("Date:"));
|
||||
QComboBox *monthCombo = new QComboBox;
|
||||
|
||||
for (int month = 1; month <= 12; ++month)
|
||||
monthCombo->addItem(QDate::longMonthName(month));
|
||||
|
||||
QDateTimeEdit *yearEdit = new QDateTimeEdit;
|
||||
yearEdit->setDisplayFormat("yyyy");
|
||||
yearEdit->setDateRange(QDate(1753, 1, 1), QDate(8000, 1, 1));
|
||||
//! [1]
|
||||
|
||||
monthCombo->setCurrentIndex(selectedDate.month() - 1);
|
||||
yearEdit->setDate(selectedDate);
|
||||
|
||||
//! [2]
|
||||
QLabel *fontSizeLabel = new QLabel(tr("Font size:"));
|
||||
QSpinBox *fontSizeSpinBox = new QSpinBox;
|
||||
fontSizeSpinBox->setRange(1, 64);
|
||||
fontSizeSpinBox->setValue(10);
|
||||
|
||||
editor = new QTextBrowser;
|
||||
insertCalendar();
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
connect(monthCombo, SIGNAL(activated(int)), this, SLOT(setMonth(int)));
|
||||
connect(yearEdit, SIGNAL(dateChanged(QDate)), this, SLOT(setYear(QDate)));
|
||||
connect(fontSizeSpinBox, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(setFontSize(int)));
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
QHBoxLayout *controlsLayout = new QHBoxLayout;
|
||||
controlsLayout->addWidget(dateLabel);
|
||||
controlsLayout->addWidget(monthCombo);
|
||||
controlsLayout->addWidget(yearEdit);
|
||||
controlsLayout->addSpacing(24);
|
||||
controlsLayout->addWidget(fontSizeLabel);
|
||||
controlsLayout->addWidget(fontSizeSpinBox);
|
||||
controlsLayout->addStretch(1);
|
||||
|
||||
QVBoxLayout *centralLayout = new QVBoxLayout;
|
||||
centralLayout->addLayout(controlsLayout);
|
||||
centralLayout->addWidget(editor, 1);
|
||||
//centralWidget->setLayout(centralLayout);
|
||||
this->setLayout(centralLayout);
|
||||
|
||||
//setCentralWidget(centralWidget);
|
||||
//! [4]
|
||||
}
|
||||
|
||||
//! [5]
|
||||
void MainWindow::insertCalendar()
|
||||
{
|
||||
editor->clear();
|
||||
QTextCursor cursor = editor->textCursor();
|
||||
cursor.beginEditBlock();
|
||||
|
||||
QDate date(selectedDate.year(), selectedDate.month(), 1);
|
||||
//! [5]
|
||||
|
||||
//! [6]
|
||||
QTextTableFormat tableFormat;
|
||||
tableFormat.setAlignment(Qt::AlignHCenter);
|
||||
tableFormat.setBackground(QColor("#e0e0e0"));
|
||||
tableFormat.setCellPadding(2);
|
||||
tableFormat.setCellSpacing(4);
|
||||
//! [6] //! [7]
|
||||
QVector<QTextLength> constraints;
|
||||
constraints << QTextLength(QTextLength::PercentageLength, 14)
|
||||
<< QTextLength(QTextLength::PercentageLength, 14)
|
||||
<< QTextLength(QTextLength::PercentageLength, 14)
|
||||
<< QTextLength(QTextLength::PercentageLength, 14)
|
||||
<< QTextLength(QTextLength::PercentageLength, 14)
|
||||
<< QTextLength(QTextLength::PercentageLength, 14)
|
||||
<< QTextLength(QTextLength::PercentageLength, 14);
|
||||
tableFormat.setColumnWidthConstraints(constraints);
|
||||
//! [7]
|
||||
|
||||
//! [8]
|
||||
QTextTable *table = cursor.insertTable(1, 7, tableFormat);
|
||||
//! [8]
|
||||
|
||||
//! [9]
|
||||
QTextFrame *frame = cursor.currentFrame();
|
||||
QTextFrameFormat frameFormat = frame->frameFormat();
|
||||
frameFormat.setBorder(1);
|
||||
frame->setFrameFormat(frameFormat);
|
||||
//! [9]
|
||||
|
||||
//! [10]
|
||||
QTextCharFormat format = cursor.charFormat();
|
||||
format.setFontPointSize(fontSize);
|
||||
|
||||
QTextCharFormat boldFormat = format;
|
||||
boldFormat.setFontWeight(QFont::Bold);
|
||||
|
||||
QTextCharFormat highlightedFormat = boldFormat;
|
||||
highlightedFormat.setBackground(Qt::yellow);
|
||||
//! [10]
|
||||
|
||||
//! [11]
|
||||
for (int weekDay = 1; weekDay <= 7; ++weekDay) {
|
||||
QTextTableCell cell = table->cellAt(0, weekDay-1);
|
||||
//! [11] //! [12]
|
||||
QTextCursor cellCursor = cell.firstCursorPosition();
|
||||
cellCursor.insertText(QString("%1").arg(QDate::longDayName(weekDay)),
|
||||
boldFormat);
|
||||
}
|
||||
//! [12]
|
||||
|
||||
//! [13]
|
||||
table->insertRows(table->rows(), 1);
|
||||
//! [13]
|
||||
|
||||
while (date.month() == selectedDate.month()) {
|
||||
int weekDay = date.dayOfWeek();
|
||||
QTextTableCell cell = table->cellAt(table->rows()-1, weekDay-1);
|
||||
QTextCursor cellCursor = cell.firstCursorPosition();
|
||||
|
||||
if (date == QDate::currentDate())
|
||||
cellCursor.insertText(QString("%1").arg(date.day()), highlightedFormat);
|
||||
else
|
||||
cellCursor.insertText(QString("%1").arg(date.day()), format);
|
||||
|
||||
date = date.addDays(1);
|
||||
if (weekDay == 7 && date.month() == selectedDate.month())
|
||||
table->insertRows(table->rows(), 1);
|
||||
}
|
||||
|
||||
cursor.endEditBlock();
|
||||
//! [14]
|
||||
setWindowTitle(tr("Calendar for %1 %2"
|
||||
).arg(QDate::longMonthName(selectedDate.month())
|
||||
).arg(selectedDate.year()));
|
||||
}
|
||||
//! [14]
|
||||
|
||||
//! [15]
|
||||
void MainWindow::setFontSize(int size)
|
||||
{
|
||||
fontSize = size;
|
||||
insertCalendar();
|
||||
}
|
||||
//! [15]
|
||||
|
||||
//! [16]
|
||||
void MainWindow::setMonth(int month)
|
||||
{
|
||||
selectedDate = QDate(selectedDate.year(), month + 1, selectedDate.day());
|
||||
insertCalendar();
|
||||
}
|
||||
//! [16]
|
||||
|
||||
//! [17]
|
||||
void MainWindow::setYear(QDate date)
|
||||
{
|
||||
selectedDate = QDate(date.year(), selectedDate.month(), selectedDate.day());
|
||||
insertCalendar();
|
||||
}
|
||||
//! [17]
|
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the example classes of the Qt Toolkit.
|
||||
**
|
||||
** 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 General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License versions 2.0 or 3.0 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
** the packaging of this file. Please review the following information
|
||||
** to ensure GNU General Public Licensing requirements will be met:
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
||||
** exception, Nokia gives you certain additional rights. These rights
|
||||
** are described in the Nokia Qt GPL Exception version 1.3, included in
|
||||
** the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Qt for Windows(R) Licensees
|
||||
** As a special exception, Nokia, as the sole copyright holder for Qt
|
||||
** Designer, grants users of the Qt/Eclipse Integration plug-in the
|
||||
** right for the Qt/Eclipse Integration to link to functionality
|
||||
** provided by Qt Designer and its related libraries.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at qt-sales@nokia.com.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QDate>
|
||||
//#include <QMainWindow>
|
||||
#include <QFrame>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextBrowser;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
//! [0]
|
||||
class MainWindow : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget* parent);
|
||||
|
||||
public slots:
|
||||
void setFontSize(int size);
|
||||
void setMonth(int month);
|
||||
void setYear(QDate date);
|
||||
|
||||
private:
|
||||
void insertCalendar();
|
||||
|
||||
int fontSize;
|
||||
QDate selectedDate;
|
||||
QTextBrowser *editor;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
#endif
|
|
@ -1,283 +0,0 @@
|
|||
# Doxyfile 1.5.1-KDevelop
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = qt_chat
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY =
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = /home/normal/
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = /home/normal/c++/qt_chat
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.d \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.idl \
|
||||
*.odl \
|
||||
*.cs \
|
||||
*.php \
|
||||
*.php3 \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py \
|
||||
*.C \
|
||||
*.CC \
|
||||
*.C++ \
|
||||
*.II \
|
||||
*.I++ \
|
||||
*.H \
|
||||
*.HH \
|
||||
*.H++ \
|
||||
*.CS \
|
||||
*.PHP \
|
||||
*.PHP3 \
|
||||
*.M \
|
||||
*.MM \
|
||||
*.PY \
|
||||
*.C \
|
||||
*.H \
|
||||
*.tlh \
|
||||
*.diff \
|
||||
*.patch \
|
||||
*.moc \
|
||||
*.xpm \
|
||||
*.dox
|
||||
RECURSIVE = yes
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = NO
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = yes
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE = qt_chat.tag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
|
@ -1,31 +0,0 @@
|
|||
//#include <QApplication>
|
||||
//#include <QString>
|
||||
//#include <QPushButton>
|
||||
|
||||
#include "I2PMessengerPlugin.h"
|
||||
#include "gui/form_Main.h"
|
||||
|
||||
QString
|
||||
I2PMessengerPlugin::pluginDescription() const
|
||||
{
|
||||
QString res;
|
||||
res = "A I2P Messenger plugin" ;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QString
|
||||
I2PMessengerPlugin::pluginName() const
|
||||
{
|
||||
return "I2P Messenger" ;
|
||||
}
|
||||
|
||||
QWidget*
|
||||
I2PMessengerPlugin::pluginWidget(QWidget * parent )
|
||||
{
|
||||
form_MainWindow* mainForm= new form_MainWindow();
|
||||
return mainForm;
|
||||
}
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2(i2pmessenger_plugin, I2PMessengerPlugin)
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef _HWA_PLUGIN_H_
|
||||
#define _HWA_PLUGIN_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <PluginInterface.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class I2PMessengerPlugin: public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
public slots:
|
||||
|
||||
virtual QString pluginDescription() const ;
|
||||
virtual QString pluginName() const ;
|
||||
|
||||
virtual QWidget* pluginWidget(QWidget * parent = 0) ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<Body>
|
||||
<div align="center">
|
||||
<br><br>
|
||||
<b><big>
|
||||
<PRE>
|
||||
Applicationversion: [APPVERSIONSTRING]
|
||||
Protocolversion: [PROTOCOLVERSIONSTRING]
|
||||
</PRE>
|
||||
</b></big>
|
||||
</div>
|
||||
</Body>
|
||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||
[%General]
|
||||
Debug_Max_Message_count=99
|
||||
Waittime_between_rechecking_offline_users=30000
|
||||
current_Style=Plastique
|
||||
current_Style_sheet=Default
|
||||
|
||||
[Network]
|
||||
Destination=test
|
||||
SamHost=192.168.0.1
|
||||
SamPort=7656
|
||||
SessionOptionString="inbound.nickname=I2PChat inbound.quantity=1 inbound.backupQuantity=1 inbound.length=1 outbound.quantity=1 outbound.backupQuantity=1 outbound.length=1"
|
||||
TunnelName=I2PChat
|
||||
inbound.backupQuantity=1
|
||||
inbound.length=1
|
||||
inbound.quantity=1
|
||||
outbound.backupQuantity=1
|
||||
outbound.length=1
|
||||
outbound.quantity=1
|
|
@ -1,76 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "form_DebugMessages.h"
|
||||
|
||||
form_DebugMessages::form_DebugMessages(cCore* core,QDialog *parent){
|
||||
setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
this->core=core;
|
||||
this->DebugMessageManager=core->get_DebugMessageHandler();
|
||||
|
||||
connect(cmd_clear,SIGNAL(clicked() ),this,SLOT(clearDebugMessages()));
|
||||
connect(DebugMessageManager,SIGNAL(newDebugMessage(QString) ),this,SLOT(newDebugMessage( QString)));
|
||||
connect(cmd_connectionDump,SIGNAL(clicked()),this,
|
||||
SLOT(connectionDump()));
|
||||
|
||||
newDebugMessage("");
|
||||
}
|
||||
|
||||
form_DebugMessages::~form_DebugMessages()
|
||||
{
|
||||
}
|
||||
|
||||
void form_DebugMessages::connectionDump()
|
||||
{
|
||||
QString Message=core->get_connectionDump();
|
||||
|
||||
QMessageBox* msgBox= new QMessageBox(this);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("DebugInformations fromCore");
|
||||
msgBox->setInformativeText(Message);
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void form_DebugMessages::newDebugMessage(QString Message)
|
||||
{
|
||||
textEdit->clear();
|
||||
|
||||
QStringList temp=DebugMessageManager->getAllMessages();
|
||||
for(int i=0;i<temp.count();i++){
|
||||
this->textEdit->append(temp[i]);
|
||||
}
|
||||
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
textEdit->setTextCursor(cursor);
|
||||
|
||||
}
|
||||
void form_DebugMessages::clearDebugMessages(){
|
||||
DebugMessageManager->clearAllMessages();
|
||||
textEdit->clear();
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef FORM_DEBUGMESSAGES_H
|
||||
#define FORM_DEBUGMESSAGES_H
|
||||
|
||||
#include <QtGui>
|
||||
#include "ui_form_DebugMessages.h"
|
||||
#include "src/Core.h"
|
||||
#include "src/DebugMessageManager.h"
|
||||
|
||||
class form_DebugMessages : public QDialog, private Ui::form_DebugMessages
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
form_DebugMessages(cCore* core,QDialog *parent = 0);
|
||||
~form_DebugMessages();
|
||||
|
||||
private slots:
|
||||
void newDebugMessage(QString Message);
|
||||
void clearDebugMessages();
|
||||
void connectionDump();
|
||||
|
||||
private:
|
||||
cCore* core;
|
||||
cDebugMessageManager* DebugMessageManager;
|
||||
};
|
||||
#endif
|
|
@ -1,77 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_DebugMessages</class>
|
||||
<widget class="QDialog" name="form_DebugMessages" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>DebugMessages</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTextEdit" name="textEdit" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cmd_connectionDump" >
|
||||
<property name="text" >
|
||||
<string>ConnectionDump</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cmd_clear" >
|
||||
<property name="text" >
|
||||
<string>&Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cmd_close" >
|
||||
<property name="text" >
|
||||
<string>C&lose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cmd_close</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>form_DebugMessages</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>296</x>
|
||||
<y>276</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,77 +0,0 @@
|
|||
/****************************************************************
|
||||
* I2P Messenger is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009, I2P Messenger
|
||||
*
|
||||
* 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 2
|
||||
* 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 "form_HelpDialog.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
|
||||
|
||||
form_HelpDialog::form_HelpDialog(QString ProgrammVersion,QString ProtocolVersion,QWidget *parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
|
||||
ui.setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
QString tmp;
|
||||
|
||||
|
||||
|
||||
QFile aboutFile(QString(QApplication::applicationDirPath()+"/about.html"));
|
||||
if (aboutFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&aboutFile);
|
||||
tmp=in.readAll();
|
||||
tmp.replace("[APPVERSIONSTRING]",ProgrammVersion);
|
||||
tmp.replace("[PROTOCOLVERSIONSTRING]",ProtocolVersion);
|
||||
ui.about->setText(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
QFile authorsFile(QLatin1String(":/authors.html"));
|
||||
if (authorsFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&authorsFile);
|
||||
ui.authors->setText(in.readAll());
|
||||
}
|
||||
QFile thanksFile(QLatin1String(":/thanks.html"));
|
||||
if (thanksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&thanksFile);
|
||||
ui.thanks->setText(in.readAll());
|
||||
}
|
||||
*/
|
||||
//ui.authors->setText
|
||||
|
||||
|
||||
ui.label_2->setMinimumWidth(20);
|
||||
}
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/****************************************************************
|
||||
* I2P Messenger is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009, I2P Messenger
|
||||
*
|
||||
* 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 2
|
||||
* 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 _HELPDIALOG_H
|
||||
#define _HELPDIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "ui_form_HelpDialog.h"
|
||||
|
||||
|
||||
class form_HelpDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
form_HelpDialog(QString ProgrammVersion,QString ProtocolVersion,QWidget *parent = 0);
|
||||
private slots:
|
||||
|
||||
private:
|
||||
Ui::form_HelpDialog ui;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,684 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_HelpDialog</class>
|
||||
<widget class="QDialog" name="form_HelpDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>501</width>
|
||||
<height>328</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>192</red>
|
||||
<green>192</green>
|
||||
<blue>192</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>208</red>
|
||||
<green>208</green>
|
||||
<blue>208</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>247</red>
|
||||
<green>247</green>
|
||||
<blue>247</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>139</red>
|
||||
<green>139</green>
|
||||
<blue>139</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>104</red>
|
||||
<green>104</green>
|
||||
<blue>104</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>240</red>
|
||||
<green>240</green>
|
||||
<blue>240</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Highlight" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="HighlightedText" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Link" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="LinkVisited" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>231</red>
|
||||
<green>231</green>
|
||||
<blue>231</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font" >
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
<underline>false</underline>
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap>:/images/info16.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; font-weight:600;">About I2P Messenger</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QTabWidget" name="tabWidget" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab" >
|
||||
<attribute name="title" >
|
||||
<string>About</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3" >
|
||||
<widget class="QTextBrowser" name="about" >
|
||||
<property name="html" >
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;"></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<attribute name="title" >
|
||||
<string>Authors</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="authors" >
|
||||
<property name="undoRedoEnabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="lineWrapMode" >
|
||||
<enum>QTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html" >
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<attribute name="title" >
|
||||
<string>Thanks to</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="thanks" >
|
||||
<property name="undoRedoEnabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="lineWrapMode" >
|
||||
<enum>QTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html" >
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>authors</tabstop>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="images.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,586 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#include "form_Main.h"
|
||||
|
||||
|
||||
|
||||
form_MainWindow::form_MainWindow(QWidget* parent)
|
||||
: QMainWindow(parent){
|
||||
setupUi(this); // this sets up GUI
|
||||
|
||||
//this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
initStyle();
|
||||
|
||||
//initTryIconMenu();
|
||||
//initTryIcon();
|
||||
init();
|
||||
}
|
||||
void form_MainWindow::init()
|
||||
{
|
||||
using namespace SESSION_Types;
|
||||
|
||||
Core= new cCore();
|
||||
fillComboBox();
|
||||
initToolBars();
|
||||
applicationIsClosing=false;
|
||||
|
||||
Mute=false;
|
||||
|
||||
|
||||
QListWidget* listWidget=this->listWidget;
|
||||
|
||||
connect (Core,SIGNAL(eventUserChanged()),this,
|
||||
SLOT(eventUserChanged()));
|
||||
|
||||
connect(Core,SIGNAL(eventOnlineStatusChanged()),this,
|
||||
SLOT(OnlineStateChanged()));
|
||||
|
||||
connect(listWidget,SIGNAL(itemDoubleClicked( QListWidgetItem* )),this,
|
||||
SLOT(openChatDialog ()));
|
||||
|
||||
connect(listWidget, SIGNAL( customContextMenuRequested(QPoint)), this,
|
||||
SLOT( connecttreeWidgetCostumPopupMenu(QPoint)));
|
||||
|
||||
connect(comboBox,SIGNAL(currentIndexChanged( int)),this,
|
||||
SLOT(onlineComboBoxChanged()));
|
||||
|
||||
this->eventUserChanged();
|
||||
}
|
||||
|
||||
form_MainWindow::~form_MainWindow(){
|
||||
|
||||
delete Core;
|
||||
//delete trayIcon;
|
||||
//applicationIsClosing=true;
|
||||
//this->close();
|
||||
}
|
||||
|
||||
|
||||
void form_MainWindow::fillComboBox()
|
||||
{
|
||||
QComboBox* comboBox = this->comboBox;
|
||||
comboBox->addItem(QIcon(ICON_USER_TRYTOCONNECT) ,"TryToConnect");
|
||||
comboBox->addItem(QIcon(ICON_USER_OFFLINE) ,"Offline");
|
||||
}
|
||||
|
||||
void form_MainWindow::onlineComboBoxChanged()
|
||||
{
|
||||
QComboBox* comboBox= this->comboBox;
|
||||
QString text=comboBox->currentText();
|
||||
|
||||
if(text.contains("Online",Qt::CaseInsensitive)==true){
|
||||
if(Core->getOnlineStatus()!=User::USERONLINE)
|
||||
Core->setOnlineStatus(User::USERONLINE);
|
||||
}
|
||||
else if(text.contains("WantToChat",Qt::CaseInsensitive)==true){
|
||||
if(Core->getOnlineStatus()!=User::USERWANTTOCHAT)
|
||||
Core->setOnlineStatus(User::USERWANTTOCHAT);
|
||||
}
|
||||
else if(text.contains("Away",Qt::CaseInsensitive)==true){
|
||||
if(Core->getOnlineStatus()!=User::USERAWAY)
|
||||
Core->setOnlineStatus(User::USERAWAY);
|
||||
}
|
||||
else if(text.contains("don't disturb",Qt::CaseInsensitive)==true){
|
||||
if(Core->getOnlineStatus()!=User::USERDONT_DISTURB)
|
||||
Core->setOnlineStatus(User::USERDONT_DISTURB);
|
||||
}
|
||||
else if(text.contains("Invisible",Qt::CaseInsensitive)==true){
|
||||
if(Core->getOnlineStatus()!=User::USERINVISIBLE)
|
||||
Core->setOnlineStatus(User::USERINVISIBLE);
|
||||
}
|
||||
else if(text.contains("Offline",Qt::CaseInsensitive)==true){
|
||||
if(Core->checkIfAFileTransferOrReciveisActive()==false){
|
||||
if(Core->getOnlineStatus()!=User::USEROFFLINE)
|
||||
Core->setOnlineStatus(User::USEROFFLINE);
|
||||
}
|
||||
else{
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("");
|
||||
msgBox->setInformativeText("Sorry a Filetransfer or Filerecive ist active,\nClosing aborted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
OnlineStateChanged();
|
||||
|
||||
}
|
||||
}
|
||||
else if(text.contains("TryToConnect",Qt::CaseInsensitive)==true){
|
||||
if(Core->getOnlineStatus()!=User::USERTRYTOCONNECT)
|
||||
Core->setOnlineStatus(User::USERTRYTOCONNECT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void form_MainWindow::initToolBars()
|
||||
{
|
||||
//toolBar->setIconSize(QSize(24, 24));
|
||||
QToolBar* toolBar=this->toolBar;
|
||||
|
||||
|
||||
toolBar->setMovable(false);
|
||||
toolBar->addAction(QIcon(ICON_NEWUSER) ,"add User" ,this,SLOT(openAdduserWindow() ) );
|
||||
toolBar->addAction(QIcon(ICON_SETTINGS) ,"Settings" ,this,SLOT(openConfigWindow() ) );
|
||||
toolBar->addAction(QIcon(ICON_DEBUGMESSAGES) ,"DebugMessages",this,SLOT(openDebugMessagesWindow() ) );
|
||||
toolBar->addAction(QIcon(ICON_MYDESTINATION) ,"ME" ,this,SLOT(namingMe()));
|
||||
//toolBar->addAction(QIcon(ICON_CLOSE) ,"Close" ,this,SLOT(closeApplication()));
|
||||
toolBar->addAction(QIcon(ICON_ABOUT) ,"About" ,this,SLOT(openAboutDialog()));
|
||||
}
|
||||
|
||||
|
||||
void form_MainWindow::openConfigWindow(){
|
||||
|
||||
form_settingsgui* dialog= new form_settingsgui();
|
||||
connect(this,SIGNAL(closeAllWindows()),dialog,
|
||||
SLOT(close()));
|
||||
|
||||
dialog->show();
|
||||
|
||||
}
|
||||
void form_MainWindow::openAdduserWindow(){
|
||||
form_newUserWindow* dialog= new form_newUserWindow(Core);
|
||||
|
||||
connect(this,SIGNAL(closeAllWindows()),dialog,
|
||||
SLOT(close()));
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void form_MainWindow::openDebugMessagesWindow(){
|
||||
form_DebugMessages* dialog= new form_DebugMessages(this->Core);
|
||||
|
||||
connect(this,SIGNAL(closeAllWindows()),dialog,
|
||||
SLOT(close()));
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void form_MainWindow::namingMe(){
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
QString Destination=Core->getMyDestination();
|
||||
if(Destination!=""){
|
||||
clipboard->setText(Destination);
|
||||
QMessageBox::information(this, "",
|
||||
"Your Destination is in the clipboard",QMessageBox::Close);
|
||||
}
|
||||
else
|
||||
QMessageBox::information(this, "",
|
||||
"Your Client must be Online for that",QMessageBox::Close);
|
||||
}
|
||||
void form_MainWindow::closeApplication(){
|
||||
|
||||
if(Core->checkIfAFileTransferOrReciveisActive()==false){
|
||||
|
||||
emit closeAllWindows();
|
||||
|
||||
delete Core;
|
||||
delete trayIcon;
|
||||
applicationIsClosing=true;
|
||||
this->close();
|
||||
}
|
||||
else{
|
||||
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("");
|
||||
msgBox->setInformativeText("Sorry a Filetransfer or Filerecive ist active,\nClosing aborted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
void form_MainWindow::eventUserChanged(){
|
||||
|
||||
bool showUnreadMessageAtTray=false;
|
||||
QList<cUser*> users=Core->get_userList();
|
||||
listWidget->clear();
|
||||
|
||||
|
||||
for(int i=0;i<users.count();i++){
|
||||
QListWidgetItem* newItem= new QListWidgetItem(listWidget);
|
||||
QListWidgetItem* ChildWidthI2PDestinationAsText= new QListWidgetItem(listWidget);
|
||||
|
||||
if(users.at(i)->getHaveNewUnreadMessages()==true){
|
||||
newItem->setIcon(QIcon(ICON_NEWUNREADMESSAGE));
|
||||
showUnreadMessageAtTray=true;
|
||||
|
||||
}
|
||||
else
|
||||
switch(users.at(i)->get_OnlineState())
|
||||
{
|
||||
|
||||
case USERTRYTOCONNECT:
|
||||
{
|
||||
newItem->setIcon(QIcon(ICON_USER_OFFLINE));
|
||||
break;
|
||||
}
|
||||
case USERINVISIBLE:
|
||||
case USEROFFLINE:
|
||||
{
|
||||
newItem->setIcon(QIcon(ICON_USER_OFFLINE));
|
||||
break;
|
||||
}
|
||||
case USERONLINE:
|
||||
{
|
||||
newItem->setIcon(QIcon(ICON_USER_ONLINE));
|
||||
break;
|
||||
}
|
||||
case USERWANTTOCHAT:
|
||||
{
|
||||
newItem->setIcon(QIcon(ICON_USER_WANTTOCHAT));
|
||||
break;
|
||||
}
|
||||
case USERAWAY:
|
||||
{
|
||||
newItem->setIcon(QIcon(ICON_USER_AWAY));
|
||||
break;
|
||||
}
|
||||
case USERDONT_DISTURB:
|
||||
{
|
||||
newItem->setIcon(QIcon(ICON_USER_DONT_DUSTURB));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
newItem->setText(users.at(i)->get_Name());
|
||||
newItem->setTextAlignment(Qt::AlignLeft);
|
||||
newItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
ChildWidthI2PDestinationAsText->setText(users.at(i)->get_I2PDestination());
|
||||
ChildWidthI2PDestinationAsText->setHidden(true);//DEBUG
|
||||
}
|
||||
|
||||
/*if(showUnreadMessageAtTray==false)
|
||||
trayIcon->setIcon(QIcon(ICON_QTCHAT));
|
||||
else
|
||||
trayIcon->setIcon(QIcon(ICON_NEWUNREADMESSAGE));*/
|
||||
}
|
||||
|
||||
//void form_MainWindow::UserDoubleClicked(QListWidgetItem * item)
|
||||
void form_MainWindow::openChatDialog()
|
||||
{
|
||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||
QString Destination =t->text();
|
||||
|
||||
cUser* User;
|
||||
User=Core->getUserByI2P_Destination(Destination);
|
||||
if(User==NULL)return;
|
||||
|
||||
if(User->getHaveAllreadyOneChatWindow()==false){
|
||||
form_ChatWidget* tmp= new form_ChatWidget(User);
|
||||
|
||||
connect(this,SIGNAL(closeAllWindows()),tmp,
|
||||
SLOT(close()));
|
||||
|
||||
eventUserChanged();
|
||||
|
||||
tmp->show();
|
||||
}
|
||||
else{
|
||||
QMessageBox::information(this, "",
|
||||
"Only one Chatwindows for each User",QMessageBox::Close);
|
||||
}
|
||||
}
|
||||
void form_MainWindow::connecttreeWidgetCostumPopupMenu(QPoint point){
|
||||
QListWidget* listWidget=this->listWidget;
|
||||
|
||||
if(listWidget->count()==0)return;
|
||||
|
||||
QMenu contextMnu( this );
|
||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton,
|
||||
Qt::RightButton, Qt::NoModifier );
|
||||
|
||||
|
||||
QAction* UserChat = new QAction("Chat",this);
|
||||
connect( UserChat , SIGNAL(triggered()),this, SLOT( openChatDialog()));
|
||||
|
||||
|
||||
QAction* UserDelete = new QAction("Delete",this);
|
||||
connect( UserDelete , SIGNAL(triggered()),this, SLOT( deleteUserClicked()));
|
||||
|
||||
QAction* UserRename = new QAction("Rename",this);
|
||||
connect(UserRename,SIGNAL(triggered()),this, SLOT(userRenameCLicked()));
|
||||
|
||||
QAction* CopyDestination = new QAction("Copy Destination",this);
|
||||
connect(CopyDestination,SIGNAL(triggered()),this, SLOT(copyDestination()));
|
||||
|
||||
|
||||
|
||||
contextMnu.clear();
|
||||
contextMnu.addAction(UserChat);
|
||||
|
||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||
QString Destination =t->text();
|
||||
|
||||
cUser* User;
|
||||
User=Core->getUserByI2P_Destination(Destination);
|
||||
|
||||
if(User->get_ConnectionStatus()==ONLINE)
|
||||
{
|
||||
QAction* UserSendFile = new QAction("SendFile",this);
|
||||
connect(UserSendFile,SIGNAL(triggered()),this, SLOT(SendFile()));
|
||||
contextMnu.addAction(UserSendFile);
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction(UserRename);
|
||||
contextMnu.addAction(UserDelete);
|
||||
contextMnu.addAction(CopyDestination);
|
||||
|
||||
contextMnu.exec( mevent->globalPos());
|
||||
}
|
||||
|
||||
void form_MainWindow::deleteUserClicked(){
|
||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||
QString Destination =t->text();
|
||||
|
||||
Core->deleteUserByI2PDestination(Destination);
|
||||
}
|
||||
|
||||
void form_MainWindow::userRenameCLicked(){
|
||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow());
|
||||
QString OldNickname=t->text();
|
||||
|
||||
QListWidgetItem *t2= listWidget->item(listWidget->currentRow()+1);
|
||||
QString Destination =t2->text();
|
||||
|
||||
form_RenameWindow* Dialog= new form_RenameWindow(Core,OldNickname,Destination);
|
||||
Dialog->show();
|
||||
}
|
||||
|
||||
/*void form_MainWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
static bool firstTime = true;
|
||||
if(applicationIsClosing==true) return;
|
||||
|
||||
if (trayIcon->isVisible()) {
|
||||
if (firstTime)
|
||||
{
|
||||
|
||||
firstTime = false;
|
||||
}
|
||||
hide();
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void form_MainWindow::updateMenu()
|
||||
{
|
||||
toggleVisibilityAction->setText(isVisible() ? tr("Hide") : tr("Show"));
|
||||
}
|
||||
|
||||
void form_MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e)
|
||||
{
|
||||
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick){
|
||||
if(isHidden()){
|
||||
show();
|
||||
|
||||
//eventUserChanged();
|
||||
|
||||
if(isMinimized()){
|
||||
if(isMaximized()){
|
||||
showMaximized();
|
||||
}else{
|
||||
showNormal();
|
||||
}
|
||||
}
|
||||
raise();
|
||||
activateWindow();
|
||||
}else{
|
||||
hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void form_MainWindow::toggleVisibilitycontextmenu()
|
||||
{
|
||||
if (isVisible())
|
||||
hide();
|
||||
else
|
||||
show();
|
||||
}*/
|
||||
|
||||
void form_MainWindow::OnlineStateChanged()
|
||||
{
|
||||
QComboBox* comboBox = this->comboBox;
|
||||
if(Core->getOnlineStatus()==User::USERONLINE)
|
||||
{
|
||||
comboBox->clear();
|
||||
comboBox->addItem(QIcon(ICON_USER_ONLINE) , "Online"); //index 0
|
||||
comboBox->addItem(QIcon(ICON_USER_WANTTOCHAT) , "WantToChat"); //1
|
||||
comboBox->addItem(QIcon(ICON_USER_AWAY) , "Away"); //2
|
||||
comboBox->addItem(QIcon(ICON_USER_DONT_DUSTURB) , "don't disturb"); //3
|
||||
comboBox->addItem(QIcon(ICON_USER_INVISIBLE) , "Invisible"); //4
|
||||
comboBox->addItem(QIcon(ICON_USER_OFFLINE) , "Offline"); //5
|
||||
|
||||
|
||||
}
|
||||
else if(Core->getOnlineStatus()==User::USEROFFLINE){
|
||||
comboBox->clear();
|
||||
comboBox->addItem(QIcon(ICON_USER_OFFLINE) , "Offline");
|
||||
comboBox->addItem(QIcon(ICON_USER_TRYTOCONNECT) , "TryToConnect");
|
||||
comboBox->setCurrentIndex(0);
|
||||
}
|
||||
else if(Core->getOnlineStatus()==User::USERWANTTOCHAT){
|
||||
comboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(Core->getOnlineStatus()==User::USERAWAY){
|
||||
comboBox->setCurrentIndex(2);
|
||||
}
|
||||
else if(Core->getOnlineStatus()==User::USERDONT_DISTURB){
|
||||
comboBox->setCurrentIndex(3);
|
||||
}
|
||||
else if(Core->getOnlineStatus()==User::USERINVISIBLE){
|
||||
comboBox->setCurrentIndex(4);
|
||||
}
|
||||
}
|
||||
|
||||
void form_MainWindow::openAboutDialog()
|
||||
{
|
||||
form_HelpDialog* dialog = new form_HelpDialog(Core->get_ClientVersion(),Core->get_ProtocolVersion());
|
||||
|
||||
connect(this,SIGNAL(closeAllWindows()),dialog,
|
||||
SLOT(close()));
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void form_MainWindow::initStyle()
|
||||
{
|
||||
QSettings * settings=new QSettings(QApplication::applicationDirPath()+"/application.ini",QSettings::IniFormat);
|
||||
settings->beginGroup("General");
|
||||
//Load Style
|
||||
QString Style=(settings->value("current_Style","")).toString();
|
||||
if(Style.isEmpty()==true)
|
||||
{
|
||||
//find default Style for this System
|
||||
QRegExp regExp("Q(.*)Style");
|
||||
Style = QApplication::style()->metaObject()->className();
|
||||
|
||||
if (Style == QLatin1String("QMacStyle"))
|
||||
Style = QLatin1String("Macintosh (Aqua)");
|
||||
else if (regExp.exactMatch(Style))
|
||||
Style = regExp.cap(1);
|
||||
|
||||
//styleCombo->addItems(QStyleFactory::keys());
|
||||
}
|
||||
|
||||
qApp->setStyle(Style);
|
||||
//Load Style end
|
||||
|
||||
//Load Stylesheet
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" +
|
||||
settings->value("current_Style_sheet","Default").toString() + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
//load Stylesheet end
|
||||
settings->endGroup();
|
||||
|
||||
delete settings;
|
||||
}
|
||||
|
||||
/*void form_MainWindow::initTryIconMenu()
|
||||
{
|
||||
// Tray icon Menu
|
||||
menu = new QMenu(this);
|
||||
QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||
toggleVisibilityAction =
|
||||
menu->addAction(QIcon(ICON_QTCHAT), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
||||
|
||||
toggleMuteAction=
|
||||
menu->addAction(QIcon(ICON_SOUND_ON), tr("Sound on"),this,SLOT(muteSound()));
|
||||
menu->addSeparator();
|
||||
//menu->addAction(QIcon(ICON_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
|
||||
//menu->addAction(QIcon(ICON_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized()));
|
||||
menu->addSeparator();
|
||||
menu->addAction(QIcon(ICON_CLOSE), tr("&Quit"), this, SLOT(closeApplication()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void form_MainWindow::initTryIcon()
|
||||
{
|
||||
// Create the tray icon
|
||||
trayIcon = new QSystemTrayIcon(this);
|
||||
trayIcon->setToolTip(tr("I2PChat"));
|
||||
trayIcon->setContextMenu(menu);
|
||||
trayIcon->setIcon(QIcon(ICON_QTCHAT));
|
||||
|
||||
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
|
||||
SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason)));
|
||||
trayIcon->show();
|
||||
}*/
|
||||
|
||||
void form_MainWindow::SendFile()
|
||||
{
|
||||
QString FilePath=QFileDialog::getOpenFileName(this,"Open File", ".", "all Files (*.*)");
|
||||
|
||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||
QString Destination =t->text();
|
||||
|
||||
if(!FilePath.isEmpty())
|
||||
Core->addNewFileTransfer(FilePath,Destination);
|
||||
|
||||
}
|
||||
|
||||
void form_MainWindow::copyDestination()
|
||||
{
|
||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||
QString Destination =t->text();
|
||||
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
|
||||
clipboard->setText(Destination);
|
||||
QMessageBox::information(this, "",
|
||||
"The Destination is in the clipboard",QMessageBox::Close);
|
||||
|
||||
}
|
||||
|
||||
void form_MainWindow::muteSound()
|
||||
{
|
||||
if(this->Mute==false)
|
||||
{
|
||||
toggleMuteAction->setIcon(QIcon(ICON_SOUND_OFF));
|
||||
toggleMuteAction->setText("Sound off");
|
||||
Mute=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleMuteAction->setIcon(QIcon(ICON_SOUND_ON));
|
||||
toggleMuteAction->setText("Sound on");
|
||||
Mute=false;
|
||||
|
||||
}
|
||||
Core->MuteSound(Mute);
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef FORM_MAIN_H
|
||||
#define FORM_MAIN_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QClipboard>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QCursor>
|
||||
#include <QPoint>
|
||||
#include <QMouseEvent>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "ui_form_Main.h"
|
||||
#include "gui_icons.h"
|
||||
#include "form_settingsgui.h"
|
||||
#include "form_newUser.h"
|
||||
#include "form_DebugMessages.h"
|
||||
#include "form_chatwidget.h"
|
||||
#include "form_rename.h"
|
||||
#include "form_HelpDialog.h"
|
||||
#include "src/Core.h"
|
||||
#include "src/User.h"
|
||||
|
||||
|
||||
class form_MainWindow : public QMainWindow, private Ui::form_MainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
form_MainWindow ( QWidget* parent=0 );
|
||||
~form_MainWindow();
|
||||
|
||||
protected:
|
||||
//void closeEvent(QCloseEvent *);
|
||||
|
||||
signals:
|
||||
void closeAllWindows();
|
||||
|
||||
private slots:
|
||||
//Windows
|
||||
void openConfigWindow();
|
||||
void openAdduserWindow();
|
||||
void openDebugMessagesWindow();
|
||||
void openAboutDialog();
|
||||
void openChatDialog ();
|
||||
//Windows end
|
||||
void namingMe();
|
||||
void copyDestination();
|
||||
void SendFile();
|
||||
void closeApplication();
|
||||
void eventUserChanged();
|
||||
void muteSound();
|
||||
|
||||
|
||||
void connecttreeWidgetCostumPopupMenu ( QPoint point );
|
||||
void deleteUserClicked();
|
||||
void userRenameCLicked();
|
||||
//void updateMenu();
|
||||
void onlineComboBoxChanged();
|
||||
//void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
||||
//void toggleVisibilitycontextmenu();
|
||||
void OnlineStateChanged();
|
||||
private:
|
||||
void init();
|
||||
void initStyle();
|
||||
//void initTryIconMenu();
|
||||
//void initTryIcon();
|
||||
void initToolBars();
|
||||
|
||||
void fillComboBox();
|
||||
|
||||
cCore* Core;
|
||||
bool applicationIsClosing;
|
||||
|
||||
cConnectionI2P* I2P;
|
||||
form_newUserWindow* newUserWindow;
|
||||
|
||||
QSystemTrayIcon *trayIcon;
|
||||
QAction* toggleVisibilityAction, *toolAct;
|
||||
QAction* toggleMuteAction;
|
||||
QMenu *menu;
|
||||
bool Mute;
|
||||
|
||||
};
|
||||
#endif
|
|
@ -1,68 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_MainWindow</class>
|
||||
<widget class="QMainWindow" name="form_MainWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>233</width>
|
||||
<height>427</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>I2PChat</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="resourcen.qrc" >:/icons/userblue24.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QComboBox" name="comboBox" >
|
||||
<property name="insertPolicy" >
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QListWidget" name="listWidget" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers" >
|
||||
<set>QAbstractItemView::AllEditTriggers</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" />
|
||||
<widget class="QToolBar" name="toolBar" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="movable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea" >
|
||||
<number>4</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resourcen.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,234 +0,0 @@
|
|||
#include "form_chatwidget.h"
|
||||
#include "src/User.h"
|
||||
|
||||
bool ChatEventEater::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if ( event->type() == QEvent::KeyPress )
|
||||
{
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if ( obj->objectName() == "message")
|
||||
{
|
||||
if ( keyEvent->key() == Qt::Key_Return && keyEvent->modifiers() == Qt::NoModifier)
|
||||
{
|
||||
emit sendMessage();
|
||||
return true;
|
||||
}
|
||||
else if (keyEvent->key() == Qt::Key_Return
|
||||
&& keyEvent->modifiers() == Qt::ControlModifier)
|
||||
{
|
||||
emit sendMessage();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
form_ChatWidget::form_ChatWidget(cUser* user,QWidget* parent /* = 0 */)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
this->user=user;
|
||||
|
||||
user->set_HaveAllreadyOneChatWindow(true);
|
||||
|
||||
QTextEdit *message=this->message;
|
||||
|
||||
m_event_eater = new ChatEventEater(this);
|
||||
connect(m_event_eater, SIGNAL(sendMessage()),
|
||||
send, SLOT(click()));
|
||||
|
||||
message->installEventFilter(m_event_eater);
|
||||
|
||||
connect(user,SIGNAL(newMessageRecived()),this,
|
||||
SLOT(newMessageRecived()));
|
||||
|
||||
connect(user,SIGNAL(OnlineStateChanged()),this,
|
||||
SLOT(changeWindowsTitle()));
|
||||
|
||||
connect(this,SIGNAL(sendChatMessage(QString)),user,
|
||||
SLOT(sendChatMessage(QString)));
|
||||
|
||||
connect(message,SIGNAL(cursorPositionChanged()),this,
|
||||
SLOT(WorkAround()));
|
||||
|
||||
|
||||
mCurrentFont = user->get_textFont();
|
||||
textColor = user->get_textColor();
|
||||
|
||||
|
||||
QPixmap pxm(24,24);
|
||||
pxm.fill(textColor);
|
||||
txtColor->setIcon(pxm);
|
||||
|
||||
|
||||
connect(send, SIGNAL(clicked()), SLOT(sendMessageSignal()));
|
||||
connect(txtColor, SIGNAL(clicked()), SLOT(setTextColor()));
|
||||
connect(txtBold, SIGNAL(clicked(bool)),SLOT(setBold(bool)));
|
||||
connect(txtFont, SIGNAL(clicked()), SLOT(setFont()));
|
||||
|
||||
message->setTextColor(textColor);
|
||||
message->setCurrentFont(mCurrentFont);
|
||||
|
||||
|
||||
resize(450,400);
|
||||
changeWindowsTitle();
|
||||
newMessageRecived();
|
||||
|
||||
}
|
||||
|
||||
void form_ChatWidget::newMessageRecived(){
|
||||
QTextEdit *chat=this->chat;
|
||||
chat->clear();
|
||||
|
||||
QStringList Messages=user->get_ChatMessages();
|
||||
int i=0;
|
||||
while(i<Messages.count()){
|
||||
QString test =Messages.at(i);
|
||||
this->addMessage(test);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void form_ChatWidget::addMessage(QString text){
|
||||
QTextEdit *chat=this->chat;
|
||||
|
||||
chat->insertHtml(text);
|
||||
|
||||
QTextCursor cursor = chat->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
chat->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
void form_ChatWidget::setTextColor(){
|
||||
QTextEdit *message=this->message;
|
||||
textColor = QColorDialog::getColor(Qt::black, this);
|
||||
|
||||
//textColor = QColorDialog::getColor(message->textColor(), this);
|
||||
QPixmap pxm(24,24);
|
||||
pxm.fill(textColor);
|
||||
txtColor->setIcon(pxm);
|
||||
user->set_textColor(textColor);
|
||||
|
||||
message->setTextColor(textColor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void form_ChatWidget::setFont()
|
||||
{
|
||||
QTextEdit *message=this->message;
|
||||
bool ok;
|
||||
mCurrentFont = QFontDialog::getFont(&ok, mCurrentFont, this);
|
||||
|
||||
user->set_textFont(mCurrentFont);
|
||||
message->setCurrentFont(mCurrentFont);
|
||||
message->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void form_ChatWidget::setBold(bool t){
|
||||
|
||||
QTextEdit *message=this->message;
|
||||
QFont font = message->currentFont();
|
||||
font.setBold(t);
|
||||
user->set_textFont(mCurrentFont);
|
||||
message->setCurrentFont(font);
|
||||
|
||||
}
|
||||
|
||||
void form_ChatWidget::closeEvent(QCloseEvent *e){
|
||||
user->set_HaveAllreadyOneChatWindow(false);
|
||||
disconnect(user,SIGNAL(newMessageRecived()),this,
|
||||
SLOT(newMessageRecived()));
|
||||
}
|
||||
|
||||
void form_ChatWidget::sendMessageSignal(){
|
||||
QTextEdit *message=this->message;
|
||||
if(message->toPlainText().length()==0)return;
|
||||
|
||||
emit sendChatMessage(message->toHtml());
|
||||
message->clear();
|
||||
|
||||
//message->document()->clear();
|
||||
|
||||
}
|
||||
|
||||
void form_ChatWidget::WorkAround()
|
||||
{
|
||||
QTextEdit *message=this->message;
|
||||
if(message->textCursor().position()>1)return;
|
||||
else if(message->textCursor().position()==1 && message->toPlainText().length()==1)
|
||||
{
|
||||
message->selectAll();
|
||||
|
||||
|
||||
//message->textCursor().setPosition(QTextCursor::Start);
|
||||
//message->textCursor().setPosition(QTextCursor::Left);
|
||||
//message->textCursor().select(QTextCursor::Document);
|
||||
//message->textCursor().movePosition(QTextCursor::End,QTextCursor::KeepAnchor);
|
||||
|
||||
message->setTextColor(textColor);
|
||||
message->setCurrentFont(mCurrentFont);
|
||||
|
||||
message->moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
|
||||
message->textCursor().clearSelection();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void form_ChatWidget::changeWindowsTitle()
|
||||
{
|
||||
QString OnlineStatus;
|
||||
QString OnlineStatusIcon;
|
||||
switch(user->get_OnlineState())
|
||||
{
|
||||
|
||||
case USERTRYTOCONNECT:
|
||||
case USERINVISIBLE:
|
||||
case USEROFFLINE:{
|
||||
OnlineStatus="offline";
|
||||
this->setWindowIcon(QIcon(ICON_USER_OFFLINE));
|
||||
break;
|
||||
}
|
||||
case USERONLINE:
|
||||
{
|
||||
OnlineStatus="online";
|
||||
this->setWindowIcon(QIcon(ICON_USER_ONLINE));
|
||||
break;
|
||||
}
|
||||
case USERWANTTOCHAT:
|
||||
{
|
||||
OnlineStatus="want to chat";
|
||||
this->setWindowIcon(QIcon(ICON_USER_WANTTOCHAT));
|
||||
break;
|
||||
}
|
||||
case USERAWAY:
|
||||
{
|
||||
OnlineStatus="away";
|
||||
this->setWindowIcon(QIcon(ICON_USER_AWAY));
|
||||
break;
|
||||
}
|
||||
case USERDONT_DISTURB:
|
||||
{
|
||||
OnlineStatus="don't disturb";
|
||||
this->setWindowIcon(QIcon(ICON_USER_DONT_DUSTURB));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
this->setWindowTitle("Chat with: "+user->get_Name()+" ("+ OnlineStatus +")");
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
#ifndef FORM_CHATWIDGET_h
|
||||
#define FORM_CHATWIDGET_h
|
||||
|
||||
|
||||
#include "ui_form_chatwidget.h"
|
||||
#include "gui_icons.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include <Qt>
|
||||
#include <QClipboard>
|
||||
#include <QKeyEvent>
|
||||
class ChatEventEater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChatEventEater(QWidget *parent = 0) : QObject(parent){ }
|
||||
bool m_send_on_enter;
|
||||
|
||||
signals:
|
||||
void sendMessage();
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
};
|
||||
|
||||
class cUser;
|
||||
class form_ChatWidget : public QWidget, public Ui::form_chatwidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
form_ChatWidget(cUser* user,QWidget* parent = 0);
|
||||
void closeEvent(QCloseEvent *e);
|
||||
private slots:
|
||||
void sendMessageSignal();
|
||||
void addMessage(QString text);
|
||||
void setTextColor();
|
||||
void newMessageRecived();
|
||||
void setBold(bool t);
|
||||
void setFont();
|
||||
void WorkAround();
|
||||
void changeWindowsTitle();
|
||||
|
||||
|
||||
signals:
|
||||
void sendChatMessage(QString chatMessage);
|
||||
|
||||
private:
|
||||
QColor textColor;
|
||||
QStringList history;
|
||||
cUser* user;
|
||||
QFont mCurrentFont;
|
||||
ChatEventEater *m_event_eater;
|
||||
};
|
||||
#endif
|
|
@ -1,297 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_chatwidget</class>
|
||||
<widget class="QWidget" name="form_chatwidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>707</width>
|
||||
<height>575</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>User Chat</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QTextBrowser" name="chat" >
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayout" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="txtBold" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>B</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="txtUnder" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>U</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="txtItalic" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>I</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="txtColor" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>C</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="txtFont" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>F</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="message" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="send" >
|
||||
<property name="text" >
|
||||
<string>Senden</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../temp/client.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>txtItalic</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
<receiver>message</receiver>
|
||||
<slot>setFontItalic(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>644</x>
|
||||
<y>258</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>348</x>
|
||||
<y>401</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>txtUnder</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
<receiver>message</receiver>
|
||||
<slot>setFontUnderline(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>614</x>
|
||||
<y>258</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>348</x>
|
||||
<y>401</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,123 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "form_fileRecive.h"
|
||||
#include "src/FileTransferRecive.h"
|
||||
|
||||
form_fileRecive::form_fileRecive(cFileTransferRecive * FileRecive)
|
||||
{
|
||||
setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
this->FileRecive=FileRecive;
|
||||
init();
|
||||
|
||||
connect(FileRecive,SIGNAL(event_FileRecivedFinishedOK()),this,
|
||||
SLOT(slot_FileRecivedFinishedOK()));
|
||||
|
||||
connect(FileRecive,SIGNAL(event_allreadyRecivedSizeChanged(quint64)),this,
|
||||
SLOT(slot_allreadyRecivedSizeChanged(quint64)));
|
||||
|
||||
connect(FileRecive,SIGNAL(event_FileReciveError()),this,
|
||||
SLOT(slot_FileReciveError()));
|
||||
|
||||
connect(FileRecive,SIGNAL(event_FileReciveAbort()),this,
|
||||
SLOT(slot_FileReciveAbort()));
|
||||
|
||||
connect(pushButton,SIGNAL(pressed()),this,
|
||||
SLOT(slot_Button()));
|
||||
|
||||
}
|
||||
|
||||
void form_fileRecive::init()
|
||||
{
|
||||
QLabel *label_4=this->label_4;
|
||||
QLabel *label_6=this->label_6;
|
||||
QLabel *label_7=this->label_7;
|
||||
QProgressBar * progressBar= this->progressBar;
|
||||
|
||||
|
||||
label_4->setText(FileRecive->get_FileName());
|
||||
|
||||
QString SSize;
|
||||
SSize.setNum(FileRecive->get_FileSize(),10);
|
||||
label_6->setText(SSize);
|
||||
label_7->setText("Bits");
|
||||
checkBox_3->setChecked(true);
|
||||
progressBar->setMinimum(0);
|
||||
progressBar->setMaximum(FileRecive->get_FileSize());
|
||||
progressBar->setValue(0);
|
||||
}
|
||||
|
||||
void form_fileRecive::slot_Button()
|
||||
{
|
||||
QPushButton* pushButton= this->pushButton;
|
||||
FileRecive->abbortFileRecive();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void form_fileRecive::slot_allreadyRecivedSizeChanged(quint64 value)
|
||||
{
|
||||
progressBar->setValue(value);
|
||||
}
|
||||
|
||||
void form_fileRecive::slot_FileRecivedFinishedOK()
|
||||
{
|
||||
QCheckBox* checkBox_4= this->checkBox_4;
|
||||
checkBox_4->setChecked(true);
|
||||
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("cFileTransfer");
|
||||
msgBox->setInformativeText("FileRecive Finished");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
void form_fileRecive::slot_FileReciveError()
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("cFileTransferRecive(StreamStatus)");
|
||||
msgBox->setInformativeText("FileRecive Error(connection Broke)\nnincomplead File deleted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
void form_fileRecive::slot_FileReciveAbort()
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("Filetransfer");
|
||||
msgBox->setInformativeText("the Sender abort the Filetransfer\nincomplead File deleted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
this->close();
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FORM_FILERECIVE_H
|
||||
#define FORM_FILERECIVE_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "ui_form_fileRecive.h"
|
||||
|
||||
|
||||
class cFileTransferRecive;
|
||||
class form_fileRecive : public QDialog, public Ui::form_FileRecive
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
form_fileRecive(cFileTransferRecive* FileRecive);
|
||||
|
||||
private slots:
|
||||
void slot_Button();
|
||||
void slot_allreadyRecivedSizeChanged(quint64 value);
|
||||
void slot_FileRecivedFinishedOK();
|
||||
void slot_FileReciveError();
|
||||
void slot_FileReciveAbort();//the othersite abort the filesend
|
||||
|
||||
|
||||
private:
|
||||
void init();
|
||||
cFileTransferRecive* FileRecive;
|
||||
};
|
||||
#endif
|
|
@ -1,206 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_FileRecive</class>
|
||||
<widget class="QDialog" name="form_FileRecive" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement" >
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>251</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>145</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_3" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Reciveing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_4" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Finished</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>266</x>
|
||||
<y>9</y>
|
||||
<width>254</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>FileInfo</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>231</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>FileName:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>FileSize:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>SizeTyp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>240</y>
|
||||
<width>75</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>abort</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>511</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>FileSend</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>progress</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>481</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>70</y>
|
||||
<width>21</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>100</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,156 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "form_fileSend.h"
|
||||
|
||||
|
||||
|
||||
form_fileSend::form_fileSend(cFileTransferSend * FileTransfer)
|
||||
{
|
||||
setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
|
||||
this->FileTransfer=FileTransfer;
|
||||
QPushButton* pushButton= this->pushButton;
|
||||
|
||||
init();
|
||||
|
||||
connect(FileTransfer,SIGNAL(event_allreadySendedSizeChanged(quint64)),this,
|
||||
SLOT(slot_allreadySendedSizeChanged(quint64)));
|
||||
|
||||
connect(FileTransfer,SIGNAL(event_FileTransferFinishedOK()),this,
|
||||
SLOT(slot_FileTransferFinishedOK()));
|
||||
|
||||
connect(FileTransfer,SIGNAL(event_FileTransferAccepted(bool)),this,
|
||||
SLOT(slot_FileTransferAccepted(bool)));
|
||||
|
||||
connect(FileTransfer,SIGNAL(event_FileTransferAborted()),this,
|
||||
SLOT(slot_FileTransferAborted()));
|
||||
|
||||
connect(FileTransfer,SIGNAL(event_FileTransferError()),this,
|
||||
SLOT(slot_FileTransferError()));
|
||||
|
||||
connect(pushButton,SIGNAL(pressed()),this,
|
||||
SLOT(slot_Button()));
|
||||
}
|
||||
|
||||
void form_fileSend::init()
|
||||
{
|
||||
|
||||
QLabel *label_4=this->label_4;
|
||||
QLabel *label_6=this->label_6;
|
||||
QLabel *label_7=this->label_7;
|
||||
QProgressBar * progressBar= this->progressBar;
|
||||
|
||||
|
||||
label_4->setText(FileTransfer->get_FileName());
|
||||
|
||||
QString SSize;
|
||||
SSize.setNum(FileTransfer->get_FileSize(),10);
|
||||
label_6->setText(SSize);
|
||||
label_7->setText("Bits");
|
||||
progressBar->setMinimum(0);
|
||||
progressBar->setMaximum(FileTransfer->get_FileSize());
|
||||
progressBar->setValue(0);
|
||||
}
|
||||
|
||||
void form_fileSend::slot_allreadySendedSizeChanged(quint64 value)
|
||||
{
|
||||
progressBar->setValue(value);
|
||||
}
|
||||
|
||||
void form_fileSend::slot_FileTransferFinishedOK()
|
||||
{
|
||||
QCheckBox* checkBox_4= this->checkBox_4;
|
||||
checkBox_4->setChecked(true);
|
||||
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("Filetransfer");
|
||||
msgBox->setInformativeText("Filetransfer Finished (OK)");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
this->close();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
void form_fileSend::slot_FileTransferAccepted(bool t)
|
||||
{
|
||||
QPushButton* pushButton= this->pushButton;
|
||||
|
||||
if(t==true){
|
||||
checkBox_2->setChecked(true);
|
||||
checkBox_3->setChecked(true);
|
||||
}
|
||||
else{
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("FileTransfer)");
|
||||
msgBox->setInformativeText("Filetransfer don't Accepted\nFileSending Abborted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
this->close();
|
||||
}
|
||||
}
|
||||
|
||||
void form_fileSend::slot_Button()
|
||||
{
|
||||
QPushButton* pushButton= this->pushButton;
|
||||
FileTransfer->abbortFileSend();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
void form_fileSend::slot_FileTransferError()
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("Filetransfer");
|
||||
msgBox->setInformativeText("FileTransfer Error(connection Broke)");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
void form_fileSend::slot_FileTransferAborted()
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
msgBox->setText("Filetransfer");
|
||||
msgBox->setInformativeText("The Reciver abort the Filerecive");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef FORM_FILESEND_H
|
||||
#define FORM_FILESEND_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "ui_form_fileSend.h"
|
||||
#include "src/FileTransferSend.h"
|
||||
class form_fileSend : public QDialog, public Ui::form_FileSend
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
form_fileSend(cFileTransferSend* FileTransfer);
|
||||
|
||||
private slots:
|
||||
void slot_allreadySendedSizeChanged(quint64 value);
|
||||
void slot_FileTransferFinishedOK();
|
||||
void slot_FileTransferError();
|
||||
void slot_FileTransferAccepted(bool t);
|
||||
void slot_FileTransferAborted();
|
||||
void slot_Button();
|
||||
|
||||
private:
|
||||
void init();
|
||||
cFileTransferSend* FileTransfer;
|
||||
};
|
||||
#endif
|
|
@ -1,242 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_FileSend</class>
|
||||
<widget class="QDialog" name="form_FileSend" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement" >
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>251</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>145</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>FileInfo sended</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_2" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>FileTransfer Accepted</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_3" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Transfering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_4" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Finished</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>266</x>
|
||||
<y>9</y>
|
||||
<width>254</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>FileInfo</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>231</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>FileName:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>FileSize:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>SizeTyp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>240</y>
|
||||
<width>75</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>abort</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>511</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>FileSend</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>progress</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>481</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>70</y>
|
||||
<width>21</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>100</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>21</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,102 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "form_newUser.h"
|
||||
|
||||
form_newUserWindow::form_newUserWindow(cCore* Core,QDialog *parent){
|
||||
setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
this->Core=Core;
|
||||
connect(buttonBox,SIGNAL(accepted()),this,SLOT(addnewUser()));
|
||||
}
|
||||
void form_newUserWindow::addnewUser()
|
||||
{
|
||||
QString Name=lineEdit->text();
|
||||
QString I2PDestination=textEdit->toPlainText();
|
||||
|
||||
if(Name.isEmpty())
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(this);
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setText("Adding User");
|
||||
msgBox->setInformativeText("You must add a nick for the User\nadding abborted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
return;
|
||||
}
|
||||
|
||||
if(I2PDestination.length()!=516)
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(this);
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setText("Adding User");
|
||||
msgBox->setInformativeText("The Destination is to short (must be 516)\nadding abborted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!I2PDestination.right(4).contains("AAAA",Qt::CaseInsensitive)){
|
||||
//the last 4 char must be "AAAA"
|
||||
QMessageBox* msgBox= new QMessageBox(this);
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setText("Adding User");
|
||||
msgBox->setInformativeText("The Destination must end with AAAA\nadding abborted");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(I2PDestination==Core->getMyDestination())
|
||||
{
|
||||
QMessageBox* msgBox= new QMessageBox(this);
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setText("Adding User");
|
||||
msgBox->setInformativeText("This Destination is yours, adding aborted !");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(Core->addNewUser(Name,I2PDestination,0)==false){
|
||||
|
||||
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setInformativeText("There allready exits one user with the same I2P,- or TorDestination");
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||
msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->show();
|
||||
|
||||
this->close();
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef FORM_NEWUSER_H
|
||||
#define FORM_NEWUSER_H
|
||||
|
||||
#include <QtGui>
|
||||
#include "ui_form_newUser.h"
|
||||
#include "src/Core.h"
|
||||
|
||||
class form_newUserWindow : public QDialog, private Ui::form_newUserWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
form_newUserWindow(cCore* Core,QDialog *parent = 0);
|
||||
|
||||
private slots:
|
||||
void addnewUser();
|
||||
|
||||
private:
|
||||
cCore* Core;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,126 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_newUserWindow</class>
|
||||
<widget class="QDialog" name="form_newUserWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>465</width>
|
||||
<height>434</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>new User</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" colspan="2" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Nickname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Destination I2P:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QTextEdit" name="textEdit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>258</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>form_newUserWindow</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>form_newUserWindow</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,41 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "form_rename.h"
|
||||
|
||||
form_RenameWindow::form_RenameWindow(cCore* Core,QString OldNickname,QString Destination){
|
||||
setupUi(this);
|
||||
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
this->Core=Core;
|
||||
this->Destination=Destination;
|
||||
|
||||
QLineEdit* lineEdit = this->lineEdit;
|
||||
lineEdit->setText(OldNickname);
|
||||
|
||||
connect(okButton,SIGNAL(clicked()),this,
|
||||
SLOT(OK()));
|
||||
}
|
||||
|
||||
void form_RenameWindow::OK(){
|
||||
QLineEdit* lineEdit_2 = this->lineEdit_2;
|
||||
Core->renameuserByI2PDestination(Destination,lineEdit_2->text());
|
||||
this->close();
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef FORM_RENAME_H
|
||||
#define FORM_RENAME_H
|
||||
|
||||
#include <QtGui>
|
||||
#include "ui_form_rename.h"
|
||||
#include "src/Core.h"
|
||||
|
||||
|
||||
class form_RenameWindow : public QDialog, private Ui::form_renameWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
form_RenameWindow(cCore* Core,QString OldNickname,QString Destination);
|
||||
private slots:
|
||||
void OK();
|
||||
private:
|
||||
cCore* Core;
|
||||
QString Destination;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,122 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>form_renameWindow</class>
|
||||
<widget class="QDialog" name="form_renameWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>152</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>New Nickname</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Old Nickname</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="lineEdit" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>New Nickname</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="lineEdit_2" />
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>268</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QPushButton" name="okButton" >
|
||||
<property name="text" >
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="CancelButton" >
|
||||
<property name="text" >
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>CancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>form_renameWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>277</x>
|
||||
<y>129</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>161</x>
|
||||
<y>75</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,313 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "form_settingsgui.h"
|
||||
|
||||
form_settingsgui::form_settingsgui(QWidget *parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
{
|
||||
setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
settings= new QSettings(QApplication::applicationDirPath()+"/application.ini",QSettings::IniFormat);
|
||||
|
||||
loadqss();
|
||||
styleCombo->addItems(QStyleFactory::keys());
|
||||
loadSettings();
|
||||
|
||||
connect(ok_Button, SIGNAL(clicked(bool) ),this,SLOT(saveSettings() ) );
|
||||
connect(cancel_Button, SIGNAL(clicked(bool) ),this,SLOT(close() ) );
|
||||
connect(cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile()));
|
||||
connect(cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2()));
|
||||
connect(cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3()));
|
||||
connect(cmd_openFile_4,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile4()));
|
||||
connect(cmd_openFile_5,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile5()));
|
||||
connect(cmd_openFile_6,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile6()));
|
||||
|
||||
}
|
||||
|
||||
form_settingsgui::~form_settingsgui()
|
||||
{
|
||||
delete (settings);
|
||||
}
|
||||
|
||||
void form_settingsgui::loadSettings()
|
||||
{
|
||||
settings->beginGroup("General");
|
||||
spinBox->setValue(settings->value("Debug_Max_Message_count","20").toInt());
|
||||
spinBox_3->setValue(settings->value("Waittime_between_rechecking_offline_users","30000").toInt()/1000);
|
||||
|
||||
|
||||
if(settings->value("current_Style","").toString().isEmpty()==false)
|
||||
styleCombo->setCurrentIndex(styleCombo->findText(settings->value("current_Style","").toString()));
|
||||
else
|
||||
{
|
||||
//find default Style for this System
|
||||
QRegExp regExp("Q(.*)Style");
|
||||
QString defaultStyle = QApplication::style()->metaObject()->className();
|
||||
|
||||
if (defaultStyle == QLatin1String("QMacStyle"))
|
||||
defaultStyle = QLatin1String("Macintosh (Aqua)");
|
||||
else if (regExp.exactMatch(defaultStyle))
|
||||
defaultStyle = regExp.cap(1);
|
||||
|
||||
//styleCombo->addItems(QStyleFactory::keys());
|
||||
styleCombo->setCurrentIndex(styleCombo->findText(defaultStyle));
|
||||
|
||||
}
|
||||
|
||||
styleSheetCombo->setCurrentIndex(styleSheetCombo->findText(settings->value("current_Style_sheet","Default").toString()));
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Network");
|
||||
lineEdit_3->setText(settings->value("SamHost","127.0.0.1").toString());
|
||||
lineEdit_2->setText(settings->value("Destination","test").toString());
|
||||
lineEdit->setText(settings->value("TunnelName","I2PChat").toString());
|
||||
spinBox_10->setValue(settings->value("SamPort","7656").toInt());
|
||||
|
||||
spinBox_4->setMinimum(1);
|
||||
spinBox_4->setValue(settings->value("inbound.length","1").toInt());
|
||||
spinBox_4->setMaximum(3);
|
||||
|
||||
spinBox_5->setMinimum(0);
|
||||
spinBox_5->setValue(settings->value("inbound.quantity","1").toInt());
|
||||
spinBox_5->setMaximum(3);
|
||||
|
||||
spinBox_6->setMinimum(0);
|
||||
spinBox_6->setValue(settings->value("inbound.backupQuantity","1").toInt());
|
||||
spinBox_6->setMaximum(3);
|
||||
|
||||
spinBox_7->setMinimum(0);
|
||||
spinBox_7->setValue(settings->value("outbound.backupQuantity","1").toInt());
|
||||
spinBox_7->setMaximum(3);
|
||||
|
||||
spinBox_8->setMinimum(1);
|
||||
spinBox_8->setValue(settings->value("outbound.length","1").toInt());
|
||||
spinBox_8->setMaximum(3);
|
||||
|
||||
spinBox_9->setMinimum(0);
|
||||
spinBox_9->setValue(settings->value("outbound.quantity","1").toInt());
|
||||
spinBox_9->setMaximum(3);
|
||||
settings->endGroup();
|
||||
|
||||
|
||||
settings->beginGroup("Sound");
|
||||
settings->beginGroup("SoundFilePath");
|
||||
txt_SoundFile->setText(settings->value("User_go_Online","").toString());
|
||||
txt_SoundFile2->setText(settings->value("User_go_Offline","").toString());
|
||||
txt_SoundFile3->setText(settings->value("FileSend_Finished","").toString());
|
||||
txt_SoundFile4->setText(settings->value("FileRecive_Incoming","").toString());
|
||||
txt_SoundFile5->setText(settings->value("FileRecive_Finished","").toString());
|
||||
txt_SoundFile6->setText(settings->value("NewChatMessage","").toString());
|
||||
|
||||
if(!txt_SoundFile->text().isEmpty())checkBoxSound->setEnabled(true);
|
||||
if(!txt_SoundFile2->text().isEmpty())checkBoxSound_2->setEnabled(true);
|
||||
if(!txt_SoundFile3->text().isEmpty())checkBoxSound_3->setEnabled(true);
|
||||
if(!txt_SoundFile4->text().isEmpty())checkBoxSound_4->setEnabled(true);
|
||||
if(!txt_SoundFile5->text().isEmpty())checkBoxSound_5->setEnabled(true);
|
||||
if(!txt_SoundFile6->text().isEmpty())checkBoxSound_6->setEnabled(true);
|
||||
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Enable");
|
||||
checkBoxSound->setChecked(settings->value("User_go_Online",false).toBool());
|
||||
checkBoxSound_2->setChecked(settings->value("User_go_Offline",false).toBool());
|
||||
checkBoxSound_3->setChecked(settings->value("FileSend_Finished",false).toBool());
|
||||
checkBoxSound_4->setChecked(settings->value("FileRecive_Incoming",false).toBool());
|
||||
checkBoxSound_5->setChecked(settings->value("FileRecive_Finished",false).toBool());
|
||||
checkBoxSound_6->setChecked(settings->value("NewChatMessage",false).toBool());
|
||||
settings->endGroup();
|
||||
|
||||
settings->endGroup();
|
||||
|
||||
}
|
||||
void form_settingsgui::saveSettings()
|
||||
{
|
||||
QString SessionOptionString;
|
||||
QString temp;
|
||||
|
||||
SessionOptionString="inbound.nickname="+lineEdit->text();
|
||||
|
||||
SessionOptionString+=" inbound.quantity=";
|
||||
temp.setNum(spinBox_5->value());
|
||||
SessionOptionString+=temp;
|
||||
|
||||
SessionOptionString+=" inbound.backupQuantity=";
|
||||
temp.setNum(spinBox_6->value());
|
||||
SessionOptionString+=temp;
|
||||
|
||||
SessionOptionString+=" inbound.length=";
|
||||
temp.setNum(spinBox_4->value());
|
||||
SessionOptionString+=temp;
|
||||
|
||||
SessionOptionString+=" outbound.quantity=";
|
||||
temp.setNum(spinBox_9->value());
|
||||
SessionOptionString+=temp;
|
||||
|
||||
SessionOptionString+=" outbound.backupQuantity=";
|
||||
temp.setNum(spinBox_7->value());
|
||||
SessionOptionString+=temp;
|
||||
|
||||
SessionOptionString+=" outbound.length=";
|
||||
temp.setNum(spinBox_8->value());
|
||||
SessionOptionString+=temp;
|
||||
|
||||
settings->beginGroup("General");
|
||||
settings->setValue("Debug_Max_Message_count",spinBox->value());
|
||||
settings->setValue("Waittime_between_rechecking_offline_users",spinBox_3->value()*1000);
|
||||
settings->setValue("current_Style",styleCombo->currentText());
|
||||
settings->setValue("current_Style_sheet",styleSheetCombo->currentText());
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Network");
|
||||
settings->setValue("SamHost",lineEdit_3->text());
|
||||
settings->setValue("Destination",lineEdit_2->text());
|
||||
settings->setValue("TunnelName",lineEdit->text());
|
||||
settings->setValue("SamPort",spinBox_10->value());
|
||||
//Inbound options
|
||||
settings->setValue("inbound.quantity",spinBox_5->value());
|
||||
settings->setValue("inbound.backupQuantity",spinBox_6->value());
|
||||
settings->setValue("inbound.length",spinBox_4->value());
|
||||
//Outpound options
|
||||
settings->setValue("outbound.quantity",spinBox_9->value());
|
||||
settings->setValue("outbound.backupQuantity",spinBox_7->value());
|
||||
settings->setValue("outbound.length",spinBox_8->value());
|
||||
|
||||
settings->setValue("SessionOptionString",SessionOptionString);
|
||||
settings->endGroup();
|
||||
settings->beginGroup("Sound");
|
||||
settings->beginGroup("Enable");
|
||||
settings->setValue("User_go_Online",checkBoxSound->isChecked());
|
||||
settings->setValue("User_go_Offline",checkBoxSound_2->isChecked());
|
||||
settings->setValue("FileSend_Finished",checkBoxSound_3->isChecked());
|
||||
settings->setValue("FileRecive_Incoming",checkBoxSound_4->isChecked());
|
||||
settings->setValue("FileRecive_Finished",checkBoxSound_5->isChecked());
|
||||
settings->setValue("NewChatMessage",checkBoxSound_6->isChecked());
|
||||
settings->endGroup();
|
||||
settings->beginGroup("SoundFilePath");
|
||||
settings->setValue("User_go_Online",txt_SoundFile->text());
|
||||
settings->setValue("User_go_Offline",txt_SoundFile2->text());
|
||||
settings->setValue("FileSend_Finished",txt_SoundFile3->text());
|
||||
settings->setValue("FileRecive_Incoming",txt_SoundFile4->text());
|
||||
settings->setValue("FileRecive_Finished",txt_SoundFile5->text());
|
||||
settings->setValue("NewChatMessage",txt_SoundFile6->text());
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void form_settingsgui::on_styleCombo_activated(const QString &styleName)
|
||||
{
|
||||
qApp->setStyle(styleName);
|
||||
|
||||
}
|
||||
|
||||
void form_settingsgui::on_styleSheetCombo_activated(const QString &sheetName)
|
||||
{
|
||||
loadStyleSheet(sheetName);
|
||||
}
|
||||
|
||||
void form_settingsgui::loadStyleSheet(const QString &sheetName)
|
||||
{
|
||||
// external Stylesheets
|
||||
QFile file(QApplication::applicationDirPath() + "/qss/" + sheetName.toLower() + ".qss");
|
||||
|
||||
file.open(QFile::ReadOnly);
|
||||
QString styleSheet = QLatin1String(file.readAll());
|
||||
|
||||
|
||||
qApp->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void form_settingsgui::loadqss()
|
||||
{
|
||||
|
||||
QFileInfoList slist = QDir(QApplication::applicationDirPath() + "/qss/").entryInfoList();
|
||||
foreach(QFileInfo st, slist)
|
||||
{
|
||||
if(st.fileName() != "." && st.fileName() != ".." && st.isFile())
|
||||
styleSheetCombo->addItem(st.fileName().remove(".qss"));
|
||||
}
|
||||
}
|
||||
////FilePath=QFileDialog::getOpenFileName(this,"Open File", ".", "all Files (*.*)");
|
||||
void form_settingsgui::on_cmd_openFile()
|
||||
{
|
||||
|
||||
txt_SoundFile->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||
if(txt_SoundFile->text().isEmpty()){
|
||||
checkBoxSound->setChecked(false);
|
||||
checkBoxSound->setEnabled(false);
|
||||
}
|
||||
else
|
||||
checkBoxSound->setEnabled(true);
|
||||
}
|
||||
|
||||
void form_settingsgui::on_cmd_openFile2()
|
||||
{
|
||||
txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||
if(txt_SoundFile2->text().isEmpty()){
|
||||
checkBoxSound_2->setChecked(false);
|
||||
checkBoxSound_2->setEnabled(false);
|
||||
}
|
||||
else
|
||||
checkBoxSound_2->setEnabled(true);
|
||||
|
||||
}
|
||||
void form_settingsgui::on_cmd_openFile3()
|
||||
{
|
||||
txt_SoundFile3->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||
if(txt_SoundFile3->text().isEmpty()){
|
||||
checkBoxSound_3->setChecked(false);
|
||||
checkBoxSound_3->setEnabled(false);
|
||||
}
|
||||
else
|
||||
checkBoxSound_3->setEnabled(true);
|
||||
}
|
||||
void form_settingsgui::on_cmd_openFile4()
|
||||
{
|
||||
txt_SoundFile4->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||
if(txt_SoundFile4->text().isEmpty()){
|
||||
checkBoxSound_4->setChecked(false);
|
||||
checkBoxSound_4->setEnabled(false);
|
||||
}
|
||||
else
|
||||
checkBoxSound_4->setEnabled(true);
|
||||
}
|
||||
void form_settingsgui::on_cmd_openFile5()
|
||||
{
|
||||
txt_SoundFile5->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||
if(txt_SoundFile5->text().isEmpty()){
|
||||
checkBoxSound_5->setChecked(false);
|
||||
checkBoxSound_5->setEnabled(false);
|
||||
}
|
||||
else
|
||||
checkBoxSound_5->setEnabled(true);
|
||||
}
|
||||
void form_settingsgui::on_cmd_openFile6()
|
||||
{
|
||||
txt_SoundFile6->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||
if(txt_SoundFile6->text().isEmpty()){
|
||||
checkBoxSound_6->setChecked(false);
|
||||
checkBoxSound_6->setEnabled(false);
|
||||
}
|
||||
else
|
||||
checkBoxSound_6->setEnabled(true);
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SETTINGSGUI_H
|
||||
#define SETTINGSGUI_H
|
||||
|
||||
#include "ui_form_settingsgui.h"
|
||||
#include <QtGui>
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
class form_settingsgui : public QDialog, private Ui::form_settingsgui
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
form_settingsgui(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
~form_settingsgui();
|
||||
|
||||
private slots:
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
void on_styleCombo_activated(const QString &styleName);
|
||||
void on_styleSheetCombo_activated(const QString &styleSheetName);
|
||||
|
||||
void on_cmd_openFile();
|
||||
void on_cmd_openFile2();
|
||||
void on_cmd_openFile3();
|
||||
void on_cmd_openFile4();
|
||||
void on_cmd_openFile5();
|
||||
void on_cmd_openFile6();
|
||||
|
||||
private:
|
||||
QSettings* settings;
|
||||
void loadStyleSheet(const QString &sheetName);
|
||||
void loadqss();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by normal *
|
||||
* normal@Desktop2 *
|
||||
* *
|
||||
* 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 2 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., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#ifndef GUI_ICONS_H
|
||||
#define GUI_ICONS_H
|
||||
|
||||
/*Icons */
|
||||
#define ICON_QUIT ":/icons/exit.png"
|
||||
#define ICON_MINIMIZE ":/icons/window_nofullscreen.png"
|
||||
#define ICON_MAXIMIZE ":/icons/window_fullscreen.png"
|
||||
#define ICON_QTCHAT ":/icons/userblue24.png"
|
||||
#define ICON_CLOSE ":/icons/exit.png"
|
||||
#define ICON_NEWUSER ":/icons/add_user.png"
|
||||
#define ICON_SETTINGS ":/icons/settings.png"
|
||||
#define ICON_NEWUNREADMESSAGE ":/icons/send.png"
|
||||
#define ICON_USER_TRYTOCONNECT ":/icons/yellow.png"
|
||||
#define ICON_USER_OFFLINE ":/icons/red.png"
|
||||
#define ICON_USER_ONLINE ":/icons/green.png"
|
||||
#define ICON_USER_WANTTOCHAT ":/icons/chatty.png"
|
||||
#define ICON_USER_AWAY ":/icons/xa.png"
|
||||
#define ICON_USER_DONT_DUSTURB ":/icons/dnd.png"
|
||||
#define ICON_USER_INVISIBLE ":/icons/invisible.png"
|
||||
#define ICON_DEBUGMESSAGES ":/icons/status_unknown.png"
|
||||
#define ICON_MYDESTINATION ":/icons/editcopy.png"
|
||||
#define ICON_ABOUT ":/icons/about.png"
|
||||
#define ICON_SOUND_ON ":/icons/sound.png"
|
||||
#define ICON_SOUND_OFF ":/icons/sound_off.png"
|
||||
|
||||
|
||||
#endif
|
Before Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 929 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 933 B |
Before Width: | Height: | Size: 894 B |
Before Width: | Height: | Size: 784 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 774 B |
|
@ -1,3 +0,0 @@
|
|||
#include "i2pmessenger_win.rc.h"
|
||||
|
||||
IDI_ICON1 ICON "gui/icons/personal.ico"
|
|
@ -1,25 +0,0 @@
|
|||
/****************************************************************
|
||||
* I2P Messenger is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2009
|
||||
*
|
||||
* 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 2
|
||||
* 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.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
|
||||
#define IDI_ICON1 101
|
||||
|