Add an installer
This commit is contained in:
parent
3768ce2f51
commit
f57013d557
@ -170,7 +170,8 @@ DISTFILES += \
|
|||||||
OlderSystemFix.patch \
|
OlderSystemFix.patch \
|
||||||
AppVeyor/appveyor.yml \
|
AppVeyor/appveyor.yml \
|
||||||
AppVeyor/make_installer.sh \
|
AppVeyor/make_installer.sh \
|
||||||
.travis.yml
|
.travis.yml \
|
||||||
|
install.sh
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
icon.qrc
|
icon.qrc
|
||||||
|
@ -43,11 +43,11 @@ You have to obtain the dependencies though.
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/ArsenArsen/KShare.git
|
git clone https://github.com/ArsenArsen/KShare.git
|
||||||
cd KShare
|
cd KShare
|
||||||
qmake // Might be qmake-qt5 on your system
|
qmake # Might be qmake-qt5 on your system
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
On systems with FFMpeg pre-3.1 you need to apply `OlderSystemFix.patch` to `recording/encoders/encoder.cpp`.
|
On systems with FFMpeg pre-3.1 you need to apply `OlderSystemFix.patch` to `recording/encoders/encoder.cpp`.
|
||||||
On systems with Qt pre-5.7 you need to install the Qt version from their website.
|
On systems with Qt pre-5.7 you need to install the Qt version from their website.
|
||||||
|
You can attempt to `curl https://raw.githubusercontent.com/ArsenArsen/KShare/master/install.sh | bash`
|
||||||
###### Started on 19th of April 2017 to bring some attention and improvement to Linux screenshotting.
|
###### Started on 19th of April 2017 to bring some attention and improvement to Linux screenshotting.
|
||||||
|
35
install.sh
Executable file
35
install.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
uname=$(uname)
|
||||||
|
function installIfNeeded {
|
||||||
|
brew ls --versions $1 > /dev/null
|
||||||
|
if [[ ! $? = 0 ]]; then brew install $1
|
||||||
|
else brew upgrade $1; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
resultfile=""
|
||||||
|
|
||||||
|
if [[ "$uname" = "Darwin" ]]; then
|
||||||
|
export PATH="/usr/local/opt/qt/bin:$PATH"
|
||||||
|
installIfNeeded qt
|
||||||
|
installIfNeeded ffmpeg
|
||||||
|
installIfNeeded pkg-config
|
||||||
|
installIfNeeded git
|
||||||
|
resultfile="$(pwd)/KShare/build/KShare.app/"
|
||||||
|
elif [[ "$uname" = "Linux" ]]; then
|
||||||
|
echo "Please install Qt5 SDK, qmake, ffmpeg development files, git, and pkgcondig"
|
||||||
|
bash
|
||||||
|
resultfile="$(pwd)/KShare/build/KShare"
|
||||||
|
else echo "Unsupported OS!" && exit 1; fi
|
||||||
|
|
||||||
|
git clone --recursive https://github.com/ArsenArsen/KShare.git || exit 2
|
||||||
|
cd KShare
|
||||||
|
mkdir build || exit 3
|
||||||
|
cd build
|
||||||
|
qmake-qt5 .. || qmake .. || exit 4
|
||||||
|
make -j$(($(nproc) + 1)) || exit 5
|
||||||
|
echo "------------------------------------------------------"
|
||||||
|
echo "Resulting file is $resultfile"
|
||||||
|
if [[ "$uname" = "Linux" ]]; then echo "To link the file into path, run sudo ln -s $resultfile /usr/bin/kshare"; fi
|
||||||
|
cd ..
|
||||||
|
echo "To update, go to $(pwd), git pull, cd build, and make -j$(($(nproc) + 1))"
|
||||||
|
echo "------------------------------------------------------"
|
@ -14,8 +14,8 @@
|
|||||||
<string>KShare</string>
|
<string>KShare</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset resource="icon.qrc">
|
||||||
<normaloff>:/icons/icon.jpg</normaloff>:/icons/icon.jpg</iconset>
|
<normaloff>:/icons/icon.svg</normaloff>:/icons/icon.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -144,6 +144,8 @@
|
|||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="icon.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -39,8 +39,6 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (std::runtime_error &e) {
|
} catch (std::runtime_error &e) {
|
||||||
// notifications::notify("KShare Video Encoder Error", e.what(),
|
|
||||||
// QSystemTrayIcon::Critical);
|
|
||||||
qCritical() << "Encoder error: " << e.what();
|
qCritical() << "Encoder error: " << e.what();
|
||||||
interrupt = true;
|
interrupt = true;
|
||||||
delete enc;
|
delete enc;
|
||||||
@ -54,8 +52,6 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
|||||||
frameAdded = true;
|
frameAdded = true;
|
||||||
enc->addFrame(img);
|
enc->addFrame(img);
|
||||||
} catch (std::runtime_error &e) {
|
} catch (std::runtime_error &e) {
|
||||||
// notifications::notify("KShare Video Encoder Error", e.what(),
|
|
||||||
// QSystemTrayIcon::Critical);
|
|
||||||
qCritical() << "Encoder error: " << e.what();
|
qCritical() << "Encoder error: " << e.what();
|
||||||
interrupt = true;
|
interrupt = true;
|
||||||
}
|
}
|
||||||
|
21
settings.cpp
21
settings.cpp
@ -1,5 +1,6 @@
|
|||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@ -7,11 +8,19 @@ QMutex *lock = new QMutex;
|
|||||||
|
|
||||||
QSettings &settings::settings() {
|
QSettings &settings::settings() {
|
||||||
QMutexLocker l(lock);
|
QMutexLocker l(lock);
|
||||||
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
|
static QSettings settings(dir().absoluteFilePath("settings.ini"), QSettings::IniFormat);
|
||||||
if (configDir.dirName() != "KShare") {
|
|
||||||
configDir.mkdir("KShare");
|
|
||||||
configDir.cd("KShare");
|
|
||||||
}
|
|
||||||
static QSettings settings(configDir.absoluteFilePath("settings.ini"), QSettings::IniFormat);
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDir settings::dir() {
|
||||||
|
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
|
||||||
|
if (configDir.dirName() != "KShare") {
|
||||||
|
if (!configDir.cd("KShare"))
|
||||||
|
if (!configDir.mkdir("KShare")) {
|
||||||
|
qFatal("Could not make config directory");
|
||||||
|
} else {
|
||||||
|
configDir.cd("KShare");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return configDir;
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
namespace settings {
|
namespace settings {
|
||||||
QSettings &settings();
|
QSettings &settings();
|
||||||
|
QDir dir();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SETTINGS_HPP
|
#endif // SETTINGS_HPP
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <screenshotutil.hpp>
|
#include <screenshotutil.hpp>
|
||||||
#include <settings.hpp>
|
#include <settings.hpp>
|
||||||
|
|
||||||
struct SegfaultWorkaround {
|
struct SegfaultWorkaround { // I'm a scrub for doing this
|
||||||
SegfaultWorkaround(QByteArray a, ImgurUploader *u, QString m) : byteArray(), dis(u), mime(m) {
|
SegfaultWorkaround(QByteArray a, ImgurUploader *u, QString m) : byteArray(), dis(u), mime(m) {
|
||||||
a.swap(byteArray);
|
a.swap(byteArray);
|
||||||
QJsonObject object;
|
QJsonObject object;
|
||||||
@ -81,16 +81,20 @@ void ImgurUploader::handleSend(QString auth, QString mime, QByteArray byteArray)
|
|||||||
ioutils::postJson(QUrl("https://api.imgur.com/3/image"),
|
ioutils::postJson(QUrl("https://api.imgur.com/3/image"),
|
||||||
QList<QPair<QString, QString>>() << QPair<QString, QString>("Content-Type", mime.toUtf8())
|
QList<QPair<QString, QString>>() << QPair<QString, QString>("Content-Type", mime.toUtf8())
|
||||||
<< QPair<QString, QString>("Authorization", auth),
|
<< QPair<QString, QString>("Authorization", auth),
|
||||||
byteArray, [](QJsonDocument res, QByteArray, QNetworkReply *) {
|
byteArray, [byteArray, this, mime](QJsonDocument res, QByteArray, QNetworkReply *r) {
|
||||||
QString result = res.object()["data"].toObject()["link"].toString();
|
QString result = res.object()["data"].toObject()["link"].toString();
|
||||||
|
if (r->error() == QNetworkReply::ContentAccessDenied) {
|
||||||
|
new SegfaultWorkaround(byteArray, this, mime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
screenshotutil::toClipboard(result);
|
screenshotutil::toClipboard(result);
|
||||||
notifications::notify("KShare imgur Uploader ", "Uploaded to imgur!");
|
notifications::notify("KShare imgur Uploader ", "Uploaded to imgur!");
|
||||||
} else {
|
} else {
|
||||||
notifications::notify("KShare imgur Uploader ",
|
notifications::notify("KShare imgur Uploader ",
|
||||||
QString("Failed upload! imgur said: HTTP %2: %1")
|
QString("Failed upload! imgur said: HTTP %1: %2")
|
||||||
.arg(res.object()["data"].toObject()["error"].toString())
|
.arg(r->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt())
|
||||||
.arg(QString::number(res.object()["status"].toInt())));
|
.arg(r->errorString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user