Skip to content

Commit

Permalink
Update NSIS installer script & fix text copy function
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-spataru committed Jun 12, 2016
1 parent 1b8c694 commit f7b3268
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 11 deletions.
8 changes: 4 additions & 4 deletions etc/deploy/windows/Info.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 VERSIONINFO
FILEVERSION 16,6,0,0
PRODUCTVERSION 16,6,0,0
FILEVERSION 16,06,0,0
PRODUCTVERSION 16,06,0,0
FILEOS 0x4
FILETYPE 0x0
BEGIN
Expand All @@ -10,12 +10,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "WinT 3794"
VALUE "FileDescription", "QDriverStation"
VALUE "FileVersion", "16,6,0,0"
VALUE "FileVersion", "16,06,0,0"
VALUE "InternalName", "QDriverStation"
VALUE "LegalCopyright", "Copyright \251 2015 WinT 3794"
VALUE "OriginalFilename", "QDriverStation"
VALUE "ProductName", "QDriverStation"
VALUE "ProductVersion", "16,6,0,0"
VALUE "ProductVersion", "16,06,0,0"
END
END

Expand Down
3 changes: 2 additions & 1 deletion etc/deploy/windows/NSIS/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ STEPS
5. Place the "bin" folder in the application folder
6. Place the files in the "goodies" folder in the application folder
7. Copy the script and place it one directory above the application folder
8. Compile the script, do not release it if you have any warning
8. Copy the license.txt and place it one directory above the application folder
9. Compile the script, do not release it if you have any warning
7 changes: 7 additions & 0 deletions etc/deploy/windows/nsis/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2015-2016 WinT 3794

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

!define APPNAME "QDriverStation"
!define UNIXNAME "qdriverstation"
!define COMPANYNAME "WinT 3794"
!define COMPANYNAME "QDriverStation Developers"
!define DESCRIPTION "Open source alternative to the FRC DriverStation"
!define VERSIONMAJOR 16
!define VERSIONMINOR 6
!define VERSIONMINOR 06
!define VERSIONBUILD 0
!define ESTIMATED_SIZE 61000
!define MUI_ABORTWARNING
Expand All @@ -35,10 +35,10 @@
!define MUI_FINISHPAGE_RUN_FUNCTION "RunApplication"
!define MUI_FINISHPAGE_LINK "Visit project website"
!define MUI_FINISHPAGE_LINK_LOCATION "http://qdriverstation.sourceforge.net"
!define MUI_FINISHPAGE_SHOWREADME "${INSTALL_DIR}\README-QDS.html"
!define MUI_FINISHPAGE_SHOWREADME "${INSTALL_DIR}\QDS-Readme.html"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${APPNAME}\LICENSE.txt"
!insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
Expand All @@ -61,7 +61,7 @@ Name "${APPNAME}"
ManifestDPIAware true
InstallDir "${INSTALL_DIR}"
RequestExecutionLevel admin
OutFile "${UNIXNAME}-${VERSIONMAJOR}.${VERSIONMINOR}${VERSIONBUILD}-installer.exe"
OutFile "${UNIXNAME}-${VERSIONMAJOR}.${VERSIONMINOR}${VERSIONBUILD}-setup.exe"

Function .onInit
setShellVarContext all
Expand Down
2 changes: 1 addition & 1 deletion qml/Messages.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ColumnLayout {
iconSize: Globals.scale (12)

onClicked: {
messages.editor.copy()
messages.copy()
messages.editor.append ("<font color=#888>** <font color=#AAA> "
+ qsTr ("Information")
+ ":</font> "
Expand Down
6 changes: 6 additions & 0 deletions qml/SettingsWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Window {
maximumHeight: Globals.scale (440)
color: Globals.Colors.WindowBackground

//
// Default window position
//
x: (Screen.width - width) / 4
y: (Screen.height - height) / 4

//
// Set window flags
//
Expand Down
6 changes: 6 additions & 0 deletions qml/VirtualJoystickWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ Window {
minimumHeight: Globals.scale (320)
maximumHeight: Globals.scale (320)

//
// Default window position
//
x: (Screen.width - width) / 4
y: (Screen.height - height) / 4

//
// Window properties
//
Expand Down
22 changes: 22 additions & 0 deletions qml/widgets/TextEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ Item {
property string backgroundColor: height > Globals.scale (140) ? Globals.Colors.WidgetBackground :
Globals.Colors.TextAreaBackground

//
// Copies the text to the system clipboard
//
function copy() {
/* Get current text */
var html = editor.getFormattedText (0, editor.length)

/* Remove HTML codes */
html = html.replace(/<style([\s\S]*?)<\/style>/gi, '');
html = html.replace(/<script([\s\S]*?)<\/script>/gi, '');
html = html.replace(/<\/div>/ig, '\n');
html = html.replace(/<\/li>/ig, '\n');
html = html.replace(/<li>/ig, ' * ');
html = html.replace(/<\/ul>/ig, '\n');
html = html.replace(/<\/p>/ig, '\n');
html = html.replace(/<br\s*[\/]?>/gi, "\n");
html = html.replace(/<[^>]+>/ig, '');

/* Copy result to system clipboard */
cUtilities.copy (html)
}

//
// Define a standard size for the widget
//
Expand Down
10 changes: 10 additions & 0 deletions src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#include "utilities.h"

#include <QClipboard>
#include <QApplication>

#if defined Q_OS_WIN
#include <pdh.h>
#include <tchar.h>
Expand Down Expand Up @@ -199,3 +202,10 @@ bool Utilities::isConnectedToPowerSource() {
return !data.contains ("discharging");
#endif
}

/**
* Copies the given \a data to the system clipboard
*/
void Utilities::copy (const QVariant& data) {
qApp->clipboard()->setText (data.toString(), QClipboard::Clipboard);
}
1 change: 1 addition & 0 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Utilities : public QObject {
Q_INVOKABLE int getCpuUsage();
Q_INVOKABLE int getBatteryLevel();
Q_INVOKABLE bool isConnectedToPowerSource();
Q_INVOKABLE void copy (const QVariant& data);
};

#endif

0 comments on commit f7b3268

Please sign in to comment.