82 |
83 |
118 | {% endblock %}
119 |
--------------------------------------------------------------------------------
/resources/update-qrc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8; -*-
3 |
4 | """
5 | Updates the qrc files according to the contents of the subdirectories.
6 | """
7 |
8 | import os
9 | import ntpath
10 | import sys
11 | from xml.etree import ElementTree
12 |
13 | RESOURCE_PATH = os.path.dirname(__file__)
14 |
15 | def make_qrc(qrc, path):
16 | output = open(qrc, 'w')
17 | builder = ElementTree.TreeBuilder()
18 | builder.start('RCC', {'version': '1.0'})
19 | builder.start('qresource', {})
20 | for root, dirs, files in os.walk(path):
21 | for f in files:
22 | builder.start('file', {})
23 | data = os.path.relpath(os.path.join(root, f), RESOURCE_PATH)
24 | if os.path == ntpath:
25 | # on windows, replace separators by forward slashes
26 | data = data.replace('\\', '/')
27 | builder.data(data)
28 | builder.end('file')
29 | builder.end('qresource')
30 | builder.end('RCC')
31 | xml = ElementTree.ElementTree(builder.close())
32 | xml.write(output)
33 | output.close()
34 |
35 | def main(args):
36 | for entry in os.listdir(RESOURCE_PATH):
37 | path = os.path.join(RESOURCE_PATH, entry)
38 | if os.path.isdir(path):
39 | qrc = os.path.join(RESOURCE_PATH, entry + '.qrc')
40 | make_qrc(qrc, path)
41 | return 0
42 |
43 | if __name__ == '__main__':
44 | sys.exit(main(sys.argv))
45 |
--------------------------------------------------------------------------------
/resources/windows.qrc:
--------------------------------------------------------------------------------
1 | windows/unzip.exe
--------------------------------------------------------------------------------
/resources/windows/unzip.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mupuf/arduide/98c4511dbcda4decf9ebc4325bc8e4979e595dc4/resources/windows/unzip.exe
--------------------------------------------------------------------------------
/translations/README:
--------------------------------------------------------------------------------
1 | If you want to translate the arduide into another language:
2 | - rename template_arduide_xx.ts to arduide_xx.ts with xx=locale (de, nl, es, ...)
3 | - run linguist on it
4 | - send the new file to martin.peres@free.fr
5 |
--------------------------------------------------------------------------------
/utils/ColorButton.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | ColorButton.cpp
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file ColorButton.cpp
26 | * \author Denis Martinez
27 | */
28 |
29 | #include "ColorButton.h"
30 |
31 | #include
32 | #include
33 |
34 | ColorButton::ColorButton(QWidget *parent)
35 | : QPushButton(parent)
36 | {
37 | connect(this, SIGNAL(clicked()), this, SLOT(chooseColor()));
38 | }
39 |
40 | void ColorButton::setColor(const QColor &color)
41 | {
42 | mColor = color;
43 | QPalette p = palette();
44 | p.setColor(QPalette::Button, color);
45 | setPalette(p);
46 | }
47 |
48 | void ColorButton::chooseColor()
49 | {
50 | QColor newColor = QColorDialog::getColor(mColor, this);
51 | if (newColor.isValid())
52 | {
53 | setColor(newColor);
54 | emit colorChosen(newColor);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/utils/ColorButton.h:
--------------------------------------------------------------------------------
1 | /*
2 | ColorButton.h
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file ColorButton.h
26 | * \author Denis Martinez
27 | */
28 |
29 | #ifndef COLORBUTTON_H
30 | #define COLORBUTTON_H
31 |
32 | #include
33 |
34 | class ColorButton : public QPushButton
35 | {
36 | Q_OBJECT
37 |
38 | public:
39 | ColorButton(QWidget *parent = NULL);
40 | const QColor &color() const { return mColor; }
41 | void setColor(const QColor &color);
42 |
43 | signals:
44 | void colorChosen(const QColor &color);
45 |
46 | private:
47 | QColor mColor;
48 |
49 | private slots:
50 | void chooseColor();
51 | };
52 |
53 | #endif // COLORBUTTON_H
54 |
--------------------------------------------------------------------------------
/utils/Compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | Compat.h
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file Compat.h
26 | * \author Denis Martinez
27 | */
28 |
29 | #ifndef COMPAT_H
30 | #define COMPAT_H
31 |
32 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
33 | #include
34 | #else
35 | #include
36 | #endif
37 |
38 | namespace Compat
39 | {
40 |
41 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
42 | static void sleep_ms(int ms)
43 | {
44 | Sleep(ms);
45 | }
46 | #else
47 | static void sleep_ms(int ms)
48 | {
49 | usleep(ms * 1000);
50 | }
51 | #endif
52 |
53 | }
54 |
55 | #endif // COMPAT_H
56 |
--------------------------------------------------------------------------------
/utils/FileUtils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | FileUtils.cpp
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file FileUtils.cpp
26 | * \author Denis Martinez
27 | */
28 |
29 | #include "FileUtils.h"
30 |
31 | #include
32 |
33 | bool FileUtils::recursiveRemove(const QString &path, bool keepDirectory)
34 | {
35 | bool ok = true;
36 |
37 | //refuse to remove the empty path (current directory)
38 | if (path.isEmpty())
39 | return false;
40 | QDir dir(path);
41 | QString entryPath;
42 | foreach (const QString &entry, dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System))
43 | {
44 | entryPath = dir.filePath(entry);
45 | QFileInfo fi(entryPath);
46 | if (fi.isDir())
47 | ok = recursiveRemove(entryPath) && ok;
48 | else
49 | ok = dir.remove(entry) && ok;
50 | }
51 |
52 | if (! keepDirectory)
53 | ok = dir.rmdir(dir.absolutePath()) && ok;
54 |
55 | return ok;
56 | }
57 |
--------------------------------------------------------------------------------
/utils/FileUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | FileUtils.h
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file FileUtils.h
26 | * \author Denis Martinez
27 | */
28 |
29 | #ifndef FILEUTILS_H
30 | #define FILEUTILS_H
31 |
32 | #include
33 |
34 | class FileUtils
35 | {
36 | public:
37 | static bool recursiveRemove(const QString &path, bool keepDirectory = false);
38 | };
39 |
40 | #endif // FILEUTILS_H
41 |
--------------------------------------------------------------------------------
/utils/Serial.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Serial.cpp
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file Serial.cpp
26 | * \author Denis Martinez
27 | * \date 2010-03-29
28 | */
29 |
30 | #include "Serial.h"
31 |
32 | #include
33 |
34 | #include "Compat.h"
35 |
36 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
37 | const Serial::descriptor Serial::INVALID_SERIAL_DESCRIPTOR = INVALID_HANDLE_VALUE;
38 | #endif
39 |
40 | Serial::Serial(const QString &port, int baudRate)
41 | : mPort(port),
42 | mBaudRate(baudRate),
43 | mSerial(INVALID_SERIAL_DESCRIPTOR),
44 | watcher(NULL)
45 | {
46 | }
47 |
48 | Serial::~Serial()
49 | {
50 | setInReadEventMode(false);
51 | }
52 |
53 | const QList &Serial::baudRates()
54 | {
55 | static const QList rates = QList() << 300 << 1200 << 2400 << 4800 << 9600 << 19200 << 38400 << 57600 << 115200;
56 | return rates;
57 | }
58 |
59 | Serial::descriptor Serial::serialDescriptor()
60 | {
61 | return mSerial;
62 | }
63 |
64 | bool Serial::isSequential() const
65 | {
66 | return true;
67 | }
68 |
69 | bool Serial::isOpen() const
70 | {
71 | return mSerial != INVALID_SERIAL_DESCRIPTOR;
72 | }
73 |
74 | QByteArray Serial::readAll()
75 | {
76 | QByteArray ret;
77 | char buf[16];
78 | qint64 size;
79 |
80 | while ((size = readData(buf, 16)) > 0)
81 | ret.append(buf, size);
82 |
83 | return ret;
84 | }
85 |
86 | bool Serial::flushBuffer()
87 | {
88 | if (! isOpen())
89 | return false;
90 |
91 | while (! readAll().isEmpty())
92 | Compat::sleep_ms(100);
93 |
94 | if (! setDTR(false))
95 | return false;
96 | Compat::sleep_ms(100);
97 | if (! setDTR(true))
98 | return false;
99 | return true;
100 | }
101 |
102 | bool Serial::isInReadEventMode()
103 | {
104 | return watcher!=NULL;
105 | }
106 |
107 | void Serial::setInReadEventMode(bool value)
108 | {
109 | if (value && watcher==NULL)
110 | {
111 | watcher = new SerialWatcher(this, this);
112 | watcher->start();
113 | }
114 | else if (!value)
115 | {
116 | if (watcher)
117 | delete watcher;
118 | watcher = NULL;
119 | }
120 | }
121 |
122 | void Serial::onNewDataArrived(QByteArray data)
123 | {
124 | emit dataArrived(data);
125 | }
126 |
--------------------------------------------------------------------------------
/utils/Serial.h:
--------------------------------------------------------------------------------
1 | /*
2 | Serial.h
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file Serial.h
26 | * \author Denis Martinez
27 | */
28 |
29 | #ifndef SERIAL_H
30 | #define SERIAL_H
31 |
32 | #include
33 | #include
34 | #include
35 |
36 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
37 | #include
38 | #endif
39 |
40 | #include "IDEGlobal.h"
41 |
42 | class SerialWatcher;
43 |
44 | class IDE_EXPORT Serial : public QIODevice
45 | {
46 | Q_OBJECT
47 |
48 | public:
49 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
50 | typedef ::HANDLE descriptor;
51 | static const descriptor INVALID_SERIAL_DESCRIPTOR;
52 | #else
53 | typedef int descriptor;
54 | static const descriptor INVALID_SERIAL_DESCRIPTOR = -1;
55 | #endif
56 |
57 | Serial(const QString &port, int baudRate = 9600);
58 | ~Serial();
59 | static const QList &baudRates();
60 |
61 | descriptor serialDescriptor();
62 | bool flushBuffer();
63 |
64 | bool isInReadEventMode();
65 | void setInReadEventMode(bool value);
66 |
67 |
68 | // QIODevice implementation
69 | bool isSequential() const;
70 | bool open(OpenMode mode);
71 | bool isOpen() const;
72 | void close();
73 | qint64 readData(char *data, qint64 maxSize);
74 | qint64 writeData(const char *data, qint64 maxSize);
75 | bool waitForReadyRead (int msecs);
76 | QByteArray readAll();
77 |
78 | signals:
79 | void dataArrived(QByteArray);
80 |
81 | private:
82 | bool setDTR(bool enable);
83 |
84 | QString mPort;
85 | int mBaudRate;
86 | descriptor mSerial;
87 |
88 | void onNewDataArrived(QByteArray data);
89 |
90 | /**************************
91 | **************************
92 | ***** SerialWatcher *****
93 | **************************
94 | **************************
95 | */
96 | class SerialWatcher : public QThread
97 | {
98 | private:
99 | bool watch;
100 | Serial* serial;
101 |
102 | public:
103 | explicit SerialWatcher(Serial* serial, QObject *parent = 0) :
104 | QThread(parent), watch(true), serial(serial)
105 | {
106 | }
107 | ~SerialWatcher()
108 | {
109 | watch = false;
110 | wait(1000);
111 | }
112 |
113 | void run()
114 | {
115 | while (serial && watch)
116 | {
117 | msleep(10);
118 | if (serial->waitForReadyRead(300) && watch) {
119 | QByteArray data = serial->readAll();
120 | if (data.length() > 0)
121 | serial->onNewDataArrived(data);
122 | }
123 | }
124 | }
125 |
126 | void startWatching(bool watch=true) { this->watch = watch; }
127 | void stopWatching(){ startWatching(false);}
128 |
129 | } *watcher;
130 | friend class SerialWatcher;
131 | };
132 |
133 | #endif // SERIAL_H
134 |
--------------------------------------------------------------------------------
/utils/hexview/Util.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2006 - 2009 Evan Teran
3 | eteran@alum.rit.edu
4 |
5 | This program is free software; you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation; either version 2 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | */
19 |
20 | #ifndef UTIL_20061126_H_
21 | #define UTIL_20061126_H_
22 |
23 | namespace util {
24 |
25 | //------------------------------------------------------------------------------
26 | // Name: safe_ctype(unsigned char c)
27 | // Desc: functions accept only unsigned char values or EOF, but 'char'
28 | // is often signed. When passing 'char', use safe_ctype(c)
29 | // instead of std::tolower(c).
30 | //------------------------------------------------------------------------------
31 | template
32 | int safe_ctype(unsigned char c) {
33 | return F(c);
34 | }
35 |
36 | //------------------------------------------------------------------------------
37 | // Name: percentage(int regionsFinished, int regionsTotal, int bytesDone, int bytesTotal)
38 | // Desc: calculates how much of a multi-region byte search we have completed
39 | //------------------------------------------------------------------------------
40 | inline int percentage(int regionsFinished, int regionsTotal, int bytesDone, int bytesTotal) {
41 |
42 | // how much percent does each region account for?
43 | const double regionStep = 1.0 / static_cast(regionsTotal) * 100;
44 |
45 | // how many regions are done?
46 | const double regionsComplete = regionStep * regionsFinished;
47 |
48 | // how much of the current region is done?
49 | const double regionPercent = regionStep * static_cast(bytesDone) / static_cast(bytesTotal);
50 |
51 | return static_cast(regionsComplete + regionPercent);
52 | }
53 |
54 | //------------------------------------------------------------------------------
55 | // Name: percentage(int regionsFinished, int regionsTotal, int bytesDone, int bytesTotal)
56 | // Desc: calculates how much of a single-region byte search we have completed
57 | //------------------------------------------------------------------------------
58 | inline int percentage(int bytesDone, int bytesTotal) {
59 | return percentage(0, 1, bytesDone, bytesTotal);
60 | }
61 |
62 | }
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/utils/hexview/format_address.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2006 - 2009 Evan Teran
3 | eteran@alum.rit.edu
4 |
5 | This program is free software; you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation; either version 2 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | */
19 |
20 | #ifndef FORMAT_ADDRESS_20090910_H_
21 | #define FORMAT_ADDRESS_20090910_H_
22 |
23 | namespace util {
24 | namespace detail {
25 | template
26 | struct address_format {};
27 |
28 | template
29 | struct address_format {
30 | template
31 | static void format_string(char (&buffer)[N], bool show_separator) {
32 | if(show_separator) {
33 | strncpy(buffer, "%04x:%04x", N);
34 | } else {
35 | strncpy(buffer, "%04x%04x", N);
36 | }
37 | buffer[N - 1] = '\0';
38 | }
39 |
40 | static QString format(const char *fmt, T address) {
41 | return QString().sprintf(fmt, (address >> 16) & 0xffff, address & 0xffff);
42 | }
43 | };
44 |
45 | template
46 | struct address_format {
47 | template
48 | static void format_string(char (&buffer)[N], bool show_separator) {
49 | if(show_separator) {
50 | strncpy(buffer, "%08x:%08x", N);
51 | } else {
52 | strncpy(buffer, "%08x%08x", N);
53 | }
54 | buffer[N - 1] = '\0';
55 | }
56 |
57 | static QString format(const char *fmt, T address) {
58 | return QString().sprintf(fmt, (address >> 32) & 0xffffffff, address & 0xffffffff);
59 | }
60 | };
61 | }
62 |
63 |
64 | template
65 | struct format_address : public detail::address_format {
66 | };
67 | }
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/utils/qxt/qxtconfigdialog.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtGui module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTCONFIGDIALOG_H
26 | #define QXTCONFIGDIALOG_H
27 |
28 | #include
29 | #include
30 | #include
31 |
32 | QT_FORWARD_DECLARE_CLASS(QDialogButtonBox)
33 |
34 | class QxtConfigDialogPrivate;
35 | class QXT_GUI_EXPORT QxtConfigDialog : public QDialog
36 | {
37 | Q_OBJECT
38 | QXT_DECLARE_PRIVATE(QxtConfigDialog)
39 |
40 | public:
41 | explicit QxtConfigDialog(QWidget* parent = 0, Qt::WindowFlags flags = 0);
42 | explicit QxtConfigDialog(QxtConfigWidget::IconPosition position, QWidget* parent = 0, Qt::WindowFlags flags = 0);
43 | virtual ~QxtConfigDialog();
44 |
45 | QDialogButtonBox* dialogButtonBox() const;
46 | void setDialogButtonBox(QDialogButtonBox* buttonBox);
47 |
48 | QxtConfigWidget* configWidget() const;
49 | void setConfigWidget(QxtConfigWidget* configWidget);
50 |
51 | public Q_SLOTS:
52 | virtual void accept();
53 | virtual void reject();
54 | };
55 |
56 | #endif // QXTCONFIGDIALOG_H
57 |
--------------------------------------------------------------------------------
/utils/qxt/qxtconfigdialog_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtGui module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTCONFIGDIALOG_P_H
26 | #define QXTCONFIGDIALOG_P_H
27 |
28 | #include "qxtconfigwidget.h"
29 | #include "qxtconfigdialog.h"
30 |
31 | QT_FORWARD_DECLARE_CLASS(QDialogButtonBox)
32 | QT_FORWARD_DECLARE_CLASS(QWidget)
33 | QT_FORWARD_DECLARE_CLASS(QxtConfigWidget)
34 | QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
35 |
36 | class QxtConfigDialogPrivate : public QObject, public QxtPrivate
37 | {
38 | Q_OBJECT
39 | public:
40 | QXT_DECLARE_PUBLIC(QxtConfigDialog)
41 |
42 | void init( QxtConfigWidget::IconPosition pos );
43 | QDialogButtonBox* buttons;
44 | QxtConfigWidget* configWidget;
45 | QVBoxLayout* layout;
46 | };
47 |
48 | #endif // QXTCONFIGDIALOG_P_H
49 |
--------------------------------------------------------------------------------
/utils/qxt/qxtconfigwidget.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtGui module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTCONFIGWIDGET_H
26 | #define QXTCONFIGWIDGET_H
27 |
28 | #include
29 | #include "qxtglobal.h"
30 |
31 | QT_FORWARD_DECLARE_CLASS(QTableWidget)
32 | QT_FORWARD_DECLARE_CLASS(QStackedWidget)
33 | QT_FORWARD_DECLARE_CLASS(QDialogButtonBox)
34 | class QxtConfigWidgetPrivate;
35 |
36 | class QXT_GUI_EXPORT QxtConfigWidget : public QWidget
37 | {
38 | Q_OBJECT
39 | QXT_DECLARE_PRIVATE(QxtConfigWidget)
40 | Q_PROPERTY(int count READ count)
41 | Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
42 | Q_PROPERTY(bool hoverEffect READ hasHoverEffect WRITE setHoverEffect)
43 | Q_PROPERTY(QxtConfigWidget::IconPosition iconPosition READ iconPosition WRITE setIconPosition)
44 | Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
45 | Q_ENUMS(IconPosition)
46 |
47 | public:
48 | enum IconPosition { North, West, East };
49 |
50 | explicit QxtConfigWidget(QWidget* parent = 0, Qt::WindowFlags flags = 0);
51 | explicit QxtConfigWidget(QxtConfigWidget::IconPosition position, QWidget* parent = 0, Qt::WindowFlags flags = 0);
52 | virtual ~QxtConfigWidget();
53 |
54 | bool hasHoverEffect() const;
55 | void setHoverEffect(bool enabled);
56 |
57 | QxtConfigWidget::IconPosition iconPosition() const;
58 | void setIconPosition(QxtConfigWidget::IconPosition position);
59 |
60 | QSize iconSize() const;
61 | void setIconSize(const QSize& size);
62 |
63 | int addPage(QWidget* page, const QIcon& icon, const QString& title = QString());
64 | int insertPage(int index, QWidget* page, const QIcon& icon, const QString& title = QString());
65 | QWidget* takePage(int index);
66 |
67 | int count() const;
68 | int currentIndex() const;
69 | QWidget* currentPage() const;
70 |
71 | int indexOf(QWidget* page) const;
72 | QWidget* page(int index) const;
73 |
74 | bool isPageEnabled(int index) const;
75 | void setPageEnabled(int index, bool enabled);
76 |
77 | bool isPageHidden(int index) const;
78 | void setPageHidden(int index, bool hidden);
79 |
80 | QIcon pageIcon(int index) const;
81 | void setPageIcon(int index, const QIcon& icon);
82 |
83 | QString pageTitle(int index) const;
84 | void setPageTitle(int index, const QString& title);
85 |
86 | QString pageToolTip(int index) const;
87 | void setPageToolTip(int index, const QString& tooltip);
88 |
89 | QString pageWhatsThis(int index) const;
90 | void setPageWhatsThis(int index, const QString& whatsthis);
91 |
92 | public Q_SLOTS:
93 | void setCurrentIndex(int index);
94 | void setCurrentPage(QWidget* page);
95 |
96 | virtual void accept();
97 | virtual void reject();
98 |
99 | Q_SIGNALS:
100 | void currentIndexChanged(int index);
101 |
102 | protected:
103 | QTableWidget* tableWidget() const;
104 | QStackedWidget* stackedWidget() const;
105 |
106 | virtual void cleanupPage(int index);
107 | virtual void initializePage(int index);
108 | };
109 |
110 | #endif // QXTCONFIGWIDGET_H
111 |
--------------------------------------------------------------------------------
/utils/qxt/qxtconfigwidget_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtGui module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTCONFIGWIDGET_P_H
26 | #define QXTCONFIGWIDGET_P_H
27 |
28 | #include "qxtconfigwidget.h"
29 | #include
30 | #include
31 |
32 | QT_FORWARD_DECLARE_CLASS(QSplitter)
33 | QT_FORWARD_DECLARE_CLASS(QStackedWidget)
34 | QT_FORWARD_DECLARE_CLASS(QDialogButtonBox)
35 |
36 | class QxtConfigTableWidget : public QTableWidget
37 | {
38 | public:
39 | QxtConfigTableWidget(QWidget* parent = 0);
40 | QStyleOptionViewItem viewOptions() const;
41 | QSize sizeHint() const;
42 |
43 | bool hasHoverEffect() const;
44 | void setHoverEffect(bool enabled);
45 | };
46 |
47 | class QxtConfigDelegate : public QItemDelegate
48 | {
49 | public:
50 | QxtConfigDelegate(QObject* parent = 0);
51 | void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
52 | QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
53 | bool hover;
54 | };
55 |
56 | class QxtConfigWidgetPrivate : public QObject, public QxtPrivate
57 | {
58 | Q_OBJECT
59 |
60 | public:
61 | QXT_DECLARE_PUBLIC(QxtConfigWidget)
62 |
63 | void init(QxtConfigWidget::IconPosition position = QxtConfigWidget::West);
64 | void initTable();
65 | void relayout();
66 | QTableWidgetItem* item(int index) const;
67 |
68 | QSplitter* splitter;
69 | QStackedWidget* stack;
70 | QxtConfigTableWidget* table;
71 | QxtConfigWidget::IconPosition pos;
72 |
73 | public Q_SLOTS:
74 | void setCurrentIndex(int row, int column);
75 | void setCurrentIndex(int index);
76 | };
77 |
78 | #endif // QXTCONFIGWIDGET_P_H
79 |
--------------------------------------------------------------------------------
/utils/qxt/qxtlineedit.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtGui module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #include "qxtlineedit.h"
26 | #include
27 | #include
28 | #include
29 |
30 | // copied from qlineedit.cpp:
31 | #define vMargin 1
32 | #define hMargin 2
33 |
34 | class QxtLineEditPrivate : public QxtPrivate
35 | {
36 | public:
37 | QString sampleText;
38 | };
39 |
40 | /*!
41 | \class QxtLineEdit
42 | \inmodule QxtGui
43 | \brief The QxtLineEdit widget is a line edit that is able to show a sample text.
44 |
45 | QxtLineEdit is a line edit that is able to show a sample text.
46 | The sample text is shown when the line edit is empty and has
47 | no focus.
48 |
49 | \image qxtlineedit.png "Two empty QxtLineEdits: non-focused and focused."
50 | */
51 |
52 | /*!
53 | Constructs a new QxtLineEdit with \a parent.
54 | */
55 | QxtLineEdit::QxtLineEdit(QWidget* parent) : QLineEdit(parent)
56 | {
57 | }
58 |
59 | /*!
60 | Constructs a new QxtLineEdit with \a text and \a parent.
61 | */
62 | QxtLineEdit::QxtLineEdit(const QString& text, QWidget* parent) : QLineEdit(text, parent)
63 | {
64 | }
65 |
66 | /*!
67 | Destructs the line edit.
68 | */
69 | QxtLineEdit::~QxtLineEdit()
70 | {
71 | }
72 |
73 | /*!
74 | \property QxtLineEdit::sampleText
75 | \brief the sample text of the line edit
76 |
77 | The sample text is shown when the line edit is empty and has
78 | no focus.
79 | */
80 | QString QxtLineEdit::sampleText() const
81 | {
82 | return qxt_d().sampleText;
83 | }
84 |
85 | void QxtLineEdit::setSampleText(const QString& text)
86 | {
87 | if (qxt_d().sampleText != text)
88 | {
89 | qxt_d().sampleText = text;
90 | if (displayText().isEmpty() && !hasFocus())
91 | update();
92 | }
93 | }
94 |
95 | /*!
96 | \reimp
97 | */
98 | void QxtLineEdit::paintEvent(QPaintEvent* event)
99 | {
100 | QLineEdit::paintEvent(event);
101 | if (displayText().isEmpty() && !hasFocus())
102 | {
103 | QStyleOptionFrameV2 option;
104 | initStyleOption(&option);
105 |
106 |
107 | QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &option, this);
108 | #if QT_VERSION >= 0x040500
109 | // TODO: sort out prior Qt 4.5
110 | int left, top, right, bottom;
111 | getTextMargins(&left, &top, &right, &bottom);
112 | r.adjust(left, top, -right, -bottom);
113 | #endif // QT_VERSION >= 0x040500
114 | r.adjust(hMargin, vMargin, -hMargin, -vMargin);
115 |
116 | QPainter painter(this);
117 | QPalette pal = palette();
118 | pal.setCurrentColorGroup(QPalette::Disabled);
119 | style()->drawItemText(&painter, r, alignment(), pal, false, qxt_d().sampleText, QPalette::Text);
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/utils/qxt/qxtlineedit.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtGui module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTLINEEDIT_H
26 | #define QXTLINEEDIT_H
27 |
28 | #include
29 | #include
30 |
31 | class QxtLineEditPrivate;
32 |
33 | class QXT_GUI_EXPORT QxtLineEdit : public QLineEdit
34 | {
35 | Q_OBJECT
36 | Q_PROPERTY(QString sampleText READ sampleText WRITE setSampleText)
37 |
38 | public:
39 | explicit QxtLineEdit(QWidget* parent = 0);
40 | QxtLineEdit(const QString& text, QWidget* parent = 0);
41 | virtual ~QxtLineEdit();
42 |
43 | QString sampleText() const;
44 |
45 | public Q_SLOTS:
46 | void setSampleText(const QString& text);
47 |
48 | protected:
49 | virtual void paintEvent(QPaintEvent* event);
50 |
51 | private:
52 | QXT_DECLARE_PRIVATE(QxtLineEdit)
53 | };
54 |
55 | #endif // QXTLINEEDIT_H
56 |
--------------------------------------------------------------------------------
/utils/qxt/qxtpimpl.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtCore module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 |
26 | #include
27 |
--------------------------------------------------------------------------------
/utils/qxt/qxtsignalwaiter.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtCore module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 |
26 |
27 | #ifndef QXTSIGNALWAITER_H
28 | #define QXTSIGNALWAITER_H
29 | #include
30 |
31 | #include
32 | #include
33 |
34 | class QxtSignalWaiterPrivate;
35 |
36 | class QXT_CORE_EXPORT QxtSignalWaiter : public QObject
37 | {
38 | Q_OBJECT
39 | QXT_DECLARE_PRIVATE(QxtSignalWaiter)
40 | public:
41 | QxtSignalWaiter(const QObject* sender, const char* signal);
42 |
43 | static bool wait(const QObject* sender, const char* signal, int msec = -1, QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents);
44 | bool wait(int msec = -1, QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents);
45 | bool hasCapturedSignal() const;
46 |
47 | public Q_SLOTS:
48 | void signalCaught();
49 | void cancelWait();
50 |
51 | private:
52 | void timerEvent(QTimerEvent* event);
53 | };
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/utils/qxt/qxttemporarydir.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtCore module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTTEMPORARYDIR_H
26 | #define QXTTEMPORARYDIR_H
27 |
28 | #include
29 | #include
30 | #include
31 |
32 | class QxtTemporaryDirPrivate;
33 |
34 | class QXT_CORE_EXPORT QxtTemporaryDir
35 | {
36 | public:
37 | QxtTemporaryDir();
38 | QxtTemporaryDir(const QString& dirTemplate);
39 | ~QxtTemporaryDir();
40 |
41 | QString dirTemplate() const;
42 | void setDirTemplate(const QString& dirTemplate);
43 |
44 | bool autoRemove() const;
45 | void setAutoRemove(bool autoRemove);
46 |
47 | bool remove();
48 |
49 | QDir dir() const;
50 | QString path() const;
51 | QString errorString() const;
52 |
53 | private:
54 | Q_DISABLE_COPY(QxtTemporaryDir)
55 | QXT_DECLARE_PRIVATE(QxtTemporaryDir)
56 | };
57 |
58 | #endif // QXTTEMPORARYDIR_H
59 |
--------------------------------------------------------------------------------
/utils/qxt/qxttemporarydir_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtCore module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #ifndef QXTTEMPORARYDIR_P_H
26 | #define QXTTEMPORARYDIR_P_H
27 |
28 | #include "qxtglobal.h"
29 | #include "qxttemporarydir.h"
30 |
31 | class QxtTemporaryDirPrivate : public QxtPrivate
32 | {
33 | public:
34 | QxtTemporaryDirPrivate();
35 |
36 | QString create();
37 | void validate();
38 |
39 | QString dirTemplate;
40 | bool autoRemove;
41 | QString error;
42 | bool init;
43 | QDir dir;
44 | };
45 |
46 | #endif // QXTTEMPORARYDIR_P_H
47 |
--------------------------------------------------------------------------------
/utils/qxt/unix/qxttemporarydir_unix.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtCore module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #include "qxttemporarydir_p.h"
26 | #include
27 |
28 | QString QxtTemporaryDirPrivate::create()
29 | {
30 | QString res;
31 | QString templateCopy = dirTemplate;
32 | if (!templateCopy.endsWith(QLatin1String("XXXXXX")))
33 | templateCopy.append(QLatin1String("XXXXXX"));
34 | char* tmpl = qstrdup(templateCopy.toLocal8Bit());
35 | char* path = mkdtemp(tmpl);
36 | if (path)
37 | res = QString::fromLocal8Bit(path);
38 | delete[] tmpl;
39 | return res;
40 | }
41 |
--------------------------------------------------------------------------------
/utils/qxt/win/qxttemporarydir_win.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) Qxt Foundation. Some rights reserved.
4 | **
5 | ** This file is part of the QxtCore module of the Qxt library.
6 | **
7 | ** This library is free software; you can redistribute it and/or modify it
8 | ** under the terms of the Common Public License, version 1.0, as published
9 | ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 | ** version 2.1, as published by the Free Software Foundation.
11 | **
12 | ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 | ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 | ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 | ** FITNESS FOR A PARTICULAR PURPOSE.
16 | **
17 | ** You should have received a copy of the CPL and the LGPL along with this
18 | ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 | ** included with the source distribution for more information.
20 | ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 | **
22 | **
23 | **
24 | ****************************************************************************/
25 | #include "qxttemporarydir_p.h"
26 | #include
27 |
28 | QString QxtTemporaryDirPrivate::create()
29 | {
30 | QString res;
31 | wchar_t buffer[MAX_PATH];
32 | QFileInfo fileInfo(dirTemplate);
33 | UINT uUnique = GetTempFileNameW((wchar_t*)fileInfo.path().utf16(), (wchar_t*)fileInfo.baseName().utf16(), 0, buffer);
34 | if (uUnique != 0)
35 | {
36 | res = QString::fromUtf16((const ushort*)buffer);
37 | QFile::remove(res);
38 | QDir().mkpath(res);
39 | }
40 | return res;
41 | }
42 |
--------------------------------------------------------------------------------
/utils/unix/Serial.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | unix/Serial.cpp
3 |
4 | This file is part of arduide, The Qt-based IDE for the open-source Arduino electronics prototyping platform.
5 |
6 | Copyright (C) 2010-2016
7 | Authors : Denis Martinez
8 | Martin Peres
9 |
10 | This program is free software; you can redistribute it and/or modify
11 | it under the terms of the GNU General Public License as published by
12 | the Free Software Foundation, either version 2 of the License, or
13 | (at your option) any later version.
14 |
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 |
20 | You should have received a copy of the GNU General Public License
21 | along with this program. If not, see .
22 | */
23 |
24 | /**
25 | * \file Serial.cpp
26 | * \author Denis Martinez
27 | */
28 |
29 | #include "../Serial.h"
30 |
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 | #include
41 |
42 | bool Serial::open(OpenMode mode)
43 | {
44 | if (isOpen())
45 | {
46 | setErrorString(tr("Device (%0) already open").arg(mPort));
47 | return false;
48 | }
49 |
50 | int realBaudRate;
51 | switch (mBaudRate)
52 | {
53 | case 300: realBaudRate = B300; break;
54 | case 1200: realBaudRate = B1200; break;
55 | case 2400: realBaudRate = B2400; break;
56 | case 4800: realBaudRate = B4800; break;
57 | case 9600: realBaudRate = B9600; break;
58 | case 19200: realBaudRate = B19200; break;
59 | case 38400: realBaudRate = B38400; break;
60 | case 57600: realBaudRate = B57600; break;
61 | case 115200: realBaudRate = B115200; break;
62 | default:
63 | setErrorString(tr("Unknown baud rate %0").arg(mBaudRate));
64 | return false;
65 | }
66 |
67 | int realMode = O_NOCTTY;
68 | if (mode & ReadWrite)
69 | realMode |= O_RDWR;
70 | else if (mode & ReadOnly)
71 | realMode |= O_RDONLY;
72 | else if (mode & WriteOnly)
73 | realMode |= O_WRONLY;
74 |
75 | mSerial = ::open(mPort.toLocal8Bit().constData(), realMode);
76 | if (mSerial < 0)
77 | goto error;
78 | if (::fcntl(mSerial, F_SETFL, FNDELAY) == -1)
79 | goto error;
80 |
81 | struct termios serial_params;
82 | if (::tcgetattr(mSerial, &serial_params) == -1)
83 | goto error;
84 | if (::cfsetispeed(&serial_params, realBaudRate) == -1)
85 | goto error;
86 | if (::cfsetospeed(&serial_params, realBaudRate) == -1)
87 | goto error;
88 | cfmakeraw(&serial_params);
89 | if (::tcsetattr(mSerial, TCSANOW, &serial_params) == -1)
90 | goto error;
91 |
92 | setOpenMode(mode);
93 | return true;
94 |
95 | error:
96 | setErrorString(QString::fromLocal8Bit(strerror(errno)));
97 | if (mSerial >= 0)
98 | {
99 | ::close(mSerial);
100 | mSerial = -1;
101 | }
102 | return false;
103 | }
104 |
105 | void Serial::close()
106 | {
107 | if (isOpen())
108 | {
109 | emit aboutToClose();
110 | ::close(mSerial);
111 | setOpenMode(NotOpen);
112 | setErrorString(QString());
113 | setInReadEventMode(false);
114 | }
115 | }
116 |
117 | qint64 Serial::readData(char *data, qint64 maxSize)
118 | {
119 | ssize_t n = ::read(mSerial, data, maxSize);
120 | if (n > 0)
121 | return n;
122 |
123 | setErrorString(QString::fromLocal8Bit(strerror(errno)));
124 | return -1;
125 | }
126 |
127 | qint64 Serial::writeData(const char *data, qint64 maxSize)
128 | {
129 | ssize_t n = ::write(mSerial, data, maxSize);
130 | if (n < 0)
131 | goto error;
132 | else
133 | return n;
134 |
135 | error:
136 | setErrorString(QString::fromLocal8Bit(strerror(errno)));
137 | return -1;
138 | }
139 |
140 | bool Serial::waitForReadyRead (int msecs)
141 | {
142 | struct pollfd pfd;
143 | pfd.fd = serialDescriptor();
144 | pfd.events |= POLLIN;
145 |
146 | int rv = poll(&pfd, 1, msecs);
147 |
148 | return rv > 0;
149 | }
150 |
151 | bool Serial::setDTR(bool enable)
152 | {
153 | if (! isOpen())
154 | return false;
155 |
156 | unsigned int result = 0;
157 | if (ioctl(mSerial, TIOCMGET, &result) == -1)
158 | return false;
159 | if (enable)
160 | result |= TIOCM_DTR;
161 | else
162 | result &= ~ TIOCM_DTR;
163 | if (ioctl(mSerial, TIOCMSET, &result) == -1)
164 | return false;
165 | return true;
166 | }
167 |
--------------------------------------------------------------------------------
/win32/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mupuf/arduide/98c4511dbcda4decf9ebc4325bc8e4979e595dc4/win32/icon.ico
--------------------------------------------------------------------------------
/win32/icon.rc:
--------------------------------------------------------------------------------
1 | 1 ICON "icon.ico"
2 |
--------------------------------------------------------------------------------
/win32/make-release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e -x
4 |
5 | base_dir=$1
6 | shift
7 | build_dir=$1
8 | shift
9 | release_dir=$1
10 | shift
11 |
12 | [ -z "${build_dir}" -o -z "${release_dir}" -o ! -d "${base_dir}" -o ! -d "${build_dir}" ] && exit 1
13 | [ -d "${release_dir}" ] && rm -r "${release_dir}"
14 | install -d "${release_dir}"
15 |
16 | function to_absolute_path()
17 | {
18 | cd "$1"
19 | pwd
20 | cd - > /dev/null
21 | }
22 |
23 | base_dir=`to_absolute_path "${base_dir}"`
24 | build_dir=`to_absolute_path "${build_dir}"`
25 | release_dir=`to_absolute_path "${release_dir}"`
26 |
27 | install -m644 "${build_dir}/arduino-ide.exe" "${release_dir}/"
28 | cd "${build_dir}"
29 | find plugins -type f -name '*.dll' -print | while read plugin; do
30 | install -Dm644 "${plugin}" "${release_dir}/${plugin}"
31 | done
32 |
33 | cd /usr/local/i486-mingw32/grantlee/lib
34 | find grantlee -type f -name '*.dll' -print | while read plugin; do
35 | install -Dm644 "${plugin}" "${release_dir}/${plugin}"
36 | done
37 |
38 | cp -dpr "${base_dir}/data" "${release_dir}/data"
39 |
40 | mkdir "${release_dir}/translations"
41 | cp -dpr ${build_dir}/*.qm "${release_dir}/translations"
42 |
43 | for dll in mingwm10.dll libgcc_s_dw2-1.dll QtCore4.dll QtGui4.dll QtNetwork4.dll QtWebKit4.dll QtScript4.dll QtXmlPatterns4.dll phonon4.dll; do
44 | install -m644 "/usr/local/i486-mingw32/qt/bin/${dll}" "${release_dir}/"
45 | done
46 |
47 | install -m644 /usr/local/i486-mingw32/qscintilla/bin/qscintilla2.dll "${release_dir}/"
48 | install -m644 /usr/local/i486-mingw32/grantlee/bin/libgrantlee_core.dll "${release_dir}/"
49 | install -m644 /usr/local/i486-mingw32/grantlee/bin/libgrantlee_gui.dll "${release_dir}/"
50 |
--------------------------------------------------------------------------------
/win32/setup.nsi:
--------------------------------------------------------------------------------
1 | !include MUI2.nsh
2 |
3 | !define PRODUCT_NAME 'Arduino IDE'
4 | !define PRODUCT_ORGANIZATION 'MuPuF.org'
5 |
6 | OutFile "setup.exe"
7 | Name '${PRODUCT_NAME}'
8 |
9 | !insertmacro MUI_PAGE_WELCOME
10 |
11 | !insertmacro MUI_PAGE_DIRECTORY
12 |
13 | ; Installer
14 | InstallDir '$PROGRAMFILES\${PRODUCT_NAME}'
15 | !insertmacro MUI_PAGE_INSTFILES
16 | !insertmacro MUI_PAGE_FINISH
17 |
18 | ; Uninstaller
19 | !insertmacro MUI_UNPAGE_CONFIRM
20 | !insertmacro MUI_UNPAGE_INSTFILES
21 | !insertmacro MUI_UNPAGE_FINISH
22 |
23 | !insertmacro MUI_LANGUAGE "English"
24 |
25 | Section Install
26 | SetOutPath '$INSTDIR'
27 | WriteUninstaller 'uninstall.exe'
28 | File /r release/*
29 | CreateDirectory '$SMPROGRAMS\${PRODUCT_NAME}'
30 | CreateShortcut '$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk' '$INSTDIR\arduino-ide.exe'
31 | CreateShortcut '$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk' '$INSTDIR\uninstall.exe'
32 | WriteRegStr HKLM 'Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}' 'DisplayName' '${PRODUCT_NAME}'
33 | WriteRegStr HKLM 'Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}' 'Publisher' '${PRODUCT_ORGANIZATION}'
34 | WriteRegStr HKLM 'Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}' 'UninstallString' '"$INSTDIR\uninstall.exe"'
35 | SectionEnd
36 |
37 | Section Uninstall
38 | RMDir /r '$INSTDIR'
39 | Delete '$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk'
40 | Delete '$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk'
41 | RMDir '$SMPROGRAMS\${PRODUCT_NAME}'
42 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
43 | SectionEnd
44 |
--------------------------------------------------------------------------------