summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2015-04-17 14:05:41 +0200
committerMichal Kubecek <mkubecek@suse.cz>2015-04-19 11:44:18 +0200
commite44b91159d2fefeb495b2c77c64ba3e7cbc0869e (patch)
tree0591e420eadf5a3124d27f9d57bfa71e868fdbaf /src
parent97d3c08dadd1ea4b0773819a69540a320590b868 (diff)
downloadtwinkle-e44b91159d2fefeb495b2c77c64ba3e7cbc0869e.tar
twinkle-e44b91159d2fefeb495b2c77c64ba3e7cbc0869e.tar.gz
twinkle-e44b91159d2fefeb495b2c77c64ba3e7cbc0869e.tar.lz
twinkle-e44b91159d2fefeb495b2c77c64ba3e7cbc0869e.tar.xz
twinkle-e44b91159d2fefeb495b2c77c64ba3e7cbc0869e.zip
automatic conversion of numberconversionform.ui
Diffstat (limited to 'src')
-rw-r--r--src/gui/numberconversionform.cpp79
-rw-r--r--src/gui/numberconversionform.h24
-rw-r--r--src/gui/numberconversionform.ui301
-rw-r--r--src/gui/numberconversionform.ui.h84
-rw-r--r--src/gui/twinkle.pro8
5 files changed, 243 insertions, 253 deletions
diff --git a/src/gui/numberconversionform.cpp b/src/gui/numberconversionform.cpp
new file mode 100644
index 0000000..16d0b3c
--- /dev/null
+++ b/src/gui/numberconversionform.cpp
@@ -0,0 +1,79 @@
+#include "numberconversionform.h"
+
+#include "gui.h"
+
+/*
+ * Constructs a NumberConversionForm which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * true to construct a modal dialog.
+ */
+NumberConversionForm::NumberConversionForm(QWidget* parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+NumberConversionForm::~NumberConversionForm()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void NumberConversionForm::init()
+{
+ QRegExp rxNoAtSign("[^@]*");
+
+ exprLineEdit->setValidator(new QRegExpValidator(rxNoAtSign, this));
+ replaceLineEdit->setValidator(new QRegExpValidator(rxNoAtSign, this));
+}
+
+int NumberConversionForm::exec(QString &expr, QString &replace)
+{
+ exprLineEdit->setText(expr);
+ replaceLineEdit->setText(replace);
+ int retval = QDialog::exec();
+
+ if (retval == QDialog::Accepted) {
+ expr = exprLineEdit->text();
+ replace = replaceLineEdit->text();
+ }
+
+ return retval;
+}
+
+void NumberConversionForm::validate()
+{
+ QString expr = exprLineEdit->text();
+ QString replace = replaceLineEdit->text();
+
+ if (expr.isEmpty()) {
+ ((t_gui *)ui)->cb_show_msg(this,
+ tr("Match expression may not be empty.").ascii(), MSG_CRITICAL);
+ exprLineEdit->setFocus();
+ exprLineEdit->selectAll();
+ return;
+ }
+
+ if (replace.isEmpty()) {
+ ((t_gui *)ui)->cb_show_msg(this,
+ tr("Replace value may not be empty.").ascii(), MSG_CRITICAL);
+ replaceLineEdit->setFocus();
+ replaceLineEdit->selectAll();
+ return;
+ }
+
+ try {
+ boost::regex re(expr.ascii());
+ } catch (boost::bad_expression) {
+ ((t_gui *)ui)->cb_show_msg(this,
+ tr("Invalid regular expression.").ascii(), MSG_CRITICAL);
+ exprLineEdit->setFocus();
+ return;
+ }
+
+ accept();
+}
diff --git a/src/gui/numberconversionform.h b/src/gui/numberconversionform.h
new file mode 100644
index 0000000..cacf47e
--- /dev/null
+++ b/src/gui/numberconversionform.h
@@ -0,0 +1,24 @@
+#ifndef NUMBERCONVERSIONFORM_H
+#define NUMBERCONVERSIONFORM_H
+
+#include <QDialog>
+#include "ui_numberconversionform.h"
+
+class NumberConversionForm : public QDialog, private Ui::NumberConversionForm
+{
+ Q_OBJECT
+
+public:
+ NumberConversionForm(QWidget* parent = 0);
+ ~NumberConversionForm();
+
+ int exec(QString& expr, QString& replace);
+
+public slots:
+ void validate();
+
+private:
+ void init();
+};
+
+#endif // NUMBERCONVERSIONFORM_H
diff --git a/src/gui/numberconversionform.ui b/src/gui/numberconversionform.ui
index 5ad490c..2a44110 100644
--- a/src/gui/numberconversionform.ui
+++ b/src/gui/numberconversionform.ui
@@ -1,175 +1,144 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>NumberConversionForm</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>NumberConversionForm</cstring>
- </property>
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0" stdsetdef="1">
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>NumberConversionForm</class>
+ <widget class="QDialog" name="NumberConversionForm">
<property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>436</width>
- <height>122</height>
- </rect>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>436</width>
+ <height>122</height>
+ </rect>
</property>
- <property name="caption">
- <string>Twinkle - Number conversion</string>
+ <property name="windowTitle">
+ <string>Twinkle - Number conversion</string>
</property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout43</cstring>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>exprTextLabel</cstring>
- </property>
- <property name="text">
- <string>&amp;Match expression:</string>
- </property>
- <property name="buddy" stdset="0">
- <cstring>exprLineEdit</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="1" column="0">
- <property name="name">
- <cstring>replaceTextLabel</cstring>
- </property>
- <property name="text">
- <string>&amp;Replace:</string>
- </property>
- <property name="buddy" stdset="0">
- <cstring>replaceLineEdit</cstring>
- </property>
- </widget>
- <widget class="QLineEdit" row="1" column="1">
- <property name="name">
- <cstring>replaceLineEdit</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Perl style format string for the replacement number.</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="0" column="1">
- <property name="name">
- <cstring>exprLineEdit</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Perl style regular expression matching the number format you want to modify.</string>
- </property>
- </widget>
- </grid>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer62</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="exprTextLabel">
+ <property name="text">
+ <string>&amp;Match expression:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>exprLineEdit</cstring>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="replaceTextLabel">
+ <property name="text">
+ <string>&amp;Replace:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>replaceLineEdit</cstring>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="replaceLineEdit">
+ <property name="whatsThis" stdset="0">
+ <string>Perl style format string for the replacement number.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="exprLineEdit">
+ <property name="whatsThis" stdset="0">
+ <string>Perl style regular expression matching the number format you want to modify.</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="spacer62">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <spacer name="spacer61">
+ <property name="sizeHint">
<size>
- <width>20</width>
- <height>20</height>
+ <width>71</width>
+ <height>20</height>
</size>
- </property>
- </spacer>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout44</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>spacer61</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>71</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>okPushButton</cstring>
- </property>
- <property name="text">
- <string>&amp;OK</string>
- </property>
- <property name="accel">
- <string>Alt+O</string>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>cancelPushButton</cstring>
- </property>
- <property name="text">
- <string>&amp;Cancel</string>
- </property>
- <property name="accel">
- <string>Alt+C</string>
- </property>
- </widget>
- </hbox>
- </widget>
- </vbox>
-</widget>
-<connections>
- <connection>
- <sender>cancelPushButton</sender>
- <signal>clicked()</signal>
- <receiver>NumberConversionForm</receiver>
- <slot>reject()</slot>
- </connection>
- <connection>
- <sender>okPushButton</sender>
- <signal>clicked()</signal>
- <receiver>NumberConversionForm</receiver>
- <slot>validate()</slot>
- </connection>
-</connections>
-<tabstops>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okPushButton">
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+O</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelPushButton">
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+C</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <tabstops>
<tabstop>exprLineEdit</tabstop>
<tabstop>replaceLineEdit</tabstop>
<tabstop>okPushButton</tabstop>
<tabstop>cancelPushButton</tabstop>
-</tabstops>
-<includes>
- <include location="local" impldecl="in implementation">qstring.h</include>
- <include location="local" impldecl="in implementation">gui.h</include>
- <include location="local" impldecl="in implementation">boost/regex.hpp</include>
- <include location="local" impldecl="in implementation">qregexp.h</include>
- <include location="local" impldecl="in implementation">qvalidator.h</include>
- <include location="local" impldecl="in implementation">numberconversionform.ui.h</include>
-</includes>
-<slots>
- <slot>validate()</slot>
-</slots>
-<functions>
- <function access="private" specifier="non virtual">init()</function>
- <function returnType="int">exec( QString &amp; expr, QString &amp; replace )</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </tabstops>
+ <connections>
+ <connection>
+ <sender>cancelPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>NumberConversionForm</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>okPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>NumberConversionForm</receiver>
+ <slot>validate()</slot>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/gui/numberconversionform.ui.h b/src/gui/numberconversionform.ui.h
deleted file mode 100644
index 6bbdaec..0000000
--- a/src/gui/numberconversionform.ui.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-/*
- Copyright (C) 2005-2009 Michel de Boer <michel@twinklephone.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 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
-*/
-
-void NumberConversionForm::init()
-{
- QRegExp rxNoAtSign("[^@]*");
-
- exprLineEdit->setValidator(new QRegExpValidator(rxNoAtSign, this));
- replaceLineEdit->setValidator(new QRegExpValidator(rxNoAtSign, this));
-}
-
-int NumberConversionForm::exec(QString &expr, QString &replace)
-{
- exprLineEdit->setText(expr);
- replaceLineEdit->setText(replace);
- int retval = QDialog::exec();
-
- if (retval == QDialog::Accepted) {
- expr = exprLineEdit->text();
- replace = replaceLineEdit->text();
- }
-
- return retval;
-}
-
-void NumberConversionForm::validate()
-{
- QString expr = exprLineEdit->text();
- QString replace = replaceLineEdit->text();
-
- if (expr.isEmpty()) {
- ((t_gui *)ui)->cb_show_msg(this,
- tr("Match expression may not be empty.").ascii(), MSG_CRITICAL);
- exprLineEdit->setFocus();
- exprLineEdit->selectAll();
- return;
- }
-
- if (replace.isEmpty()) {
- ((t_gui *)ui)->cb_show_msg(this,
- tr("Replace value may not be empty.").ascii(), MSG_CRITICAL);
- replaceLineEdit->setFocus();
- replaceLineEdit->selectAll();
- return;
- }
-
- try {
- boost::regex re(expr.ascii());
- } catch (boost::bad_expression) {
- ((t_gui *)ui)->cb_show_msg(this,
- tr("Invalid regular expression.").ascii(), MSG_CRITICAL);
- exprLineEdit->setFocus();
- return;
- }
-
- accept();
-}
diff --git a/src/gui/twinkle.pro b/src/gui/twinkle.pro
index 6c7e7f6..b4c73c2 100644
--- a/src/gui/twinkle.pro
+++ b/src/gui/twinkle.pro
@@ -1,7 +1,7 @@
TEMPLATE = app
LANGUAGE = C++
-CONFIG += qt warn_on release thread
+CONFIG += qt warn_on debug thread
LIBS += ../libtwinkle.a ../parser/libsipparser.a ../sdp/libsdpparser.a ../sockets/libsocket.a ../threads/libthread.a ../audio/libaudio.a ../audits/libaudits.a ../stun/libstun.a ../mwi/libmwi.a ../im/libim.a ../patterns/libpatterns.a ../presence/libpresence.a ../utils/libutils.a -lsndfile -lmagic -lncurses -lreadline -lX11
@@ -13,6 +13,7 @@ HEADERS += gui.h \
dtmfform.h \
deregisterform.h \
logviewform.h \
+ numberconversionform.h \
historylistview.h \
freedesksystray.h \
twinklesystray.h \
@@ -32,6 +33,7 @@ SOURCES += main.cpp \
dtmfform.cpp \
deregisterform.cpp \
logviewform.cpp \
+ numberconversionform.cpp \
historylistview.cpp \
freedesksystray.cpp \
twinklesystray.cpp \
@@ -44,7 +46,8 @@ SOURCES += main.cpp \
FORMS = dtmfform.ui \
deregisterform.ui \
- logviewform.ui
+ logviewform.ui \
+ numberconversionform.ui
#The following line was changed from FORMS to FORMS3 by qt3to4
FORMS3 = mphoneform.ui \
@@ -63,7 +66,6 @@ FORMS3 = mphoneform.ui \
getaddressform.ui \
historyform.ui \
selectuserform.ui \
- numberconversionform.ui \
addresscardform.ui \
messageform.ui \
buddyform.ui \