Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Build error #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 78 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,80 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------

*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
.qmake.cache
.qmake.stash

# qtcreator generated files
*.pro.user*

# xemacs temporary files
*.flc

# Vim temporary files
.*.swp

# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*

# MinGW generated files
*.Debug
*.Release

# Python byte code
*.pyc

# Binaries
# --------
*.dll
*.exe

# DBus tmp files
agent_adaptor.*
agent_interface.*

# Build
/Build/
*.2-pre1
*.autosave
*.pro.*
2 changes: 1 addition & 1 deletion dialogs/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void OptionsDialog::updatePreview()
options.dateFormat = settings()->value("options/naming/dateFormat", "yyyy-MM-dd").toString();

if (ui.fileGroupBox->isChecked()) { // Only change the naming button when file options are enabled.
ui.namingOptionsButton->setDisabled((options.naming == Screenshot::Empty));
ui.namingOptionsButton->setDisabled((options.naming == Screenshot::Naming::N_Empty));
}

QString preview = Screenshot::getName(options,
Expand Down
18 changes: 18 additions & 0 deletions lightscreen.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@ TEMPLATE = app
TARGET = lightscreen
DEFINES += QT_DEPRECATED_WARNINGS

DESTDIR = $${PWD}/Build
BUILDDIR = $${DESTDIR}/.tmp/$${TARGET}

CONFIG(debug, debug|release) {
win32: BUILDDIR = $${BUILDDIR}/win32-debug
linux: BUILDDIR = $${BUILDDIR}/linux-debug
} else {
win32: BUILDDIR = $${BUILDDIR}/win32-release
linux: BUILDDIR = $${BUILDDIR}/linux-release
}

MOC_DIR += $${BUILDDIR}
OBJECTS_DIR += $${BUILDDIR}/obj
UI_DIR += $${BUILDDIR}
RCC_DIR += $${BUILDDIR}

INCLUDEPATH += $${UI_DIR}

HEADERS += dialogs/areadialog.h \
dialogs/historydialog.h \
dialogs/namingdialog.h \
Expand Down
54 changes: 27 additions & 27 deletions lightscreenwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ LightscreenWindow::LightscreenWindow(QWidget *parent) :
mReviveMain(false),
mWasVisible(true),
mLastMessage(0),
mLastMode(Screenshot::None),
mLastMode(Screenshot::Mode::M_None),
mLastScreenshot(),
mHasTaskbarButton(false)
{
Expand Down Expand Up @@ -140,7 +140,7 @@ LightscreenWindow::~LightscreenWindow()

void LightscreenWindow::action(int mode)
{
if (mode <= Screenshot::SelectedWindow) {
if (mode <= static_cast<int>(Screenshot::Mode::M_SelectedWindow)) {
screenshotAction((Screenshot::Mode)mode);
} else if (mode == ShowMainWindow) {
show();
Expand All @@ -153,7 +153,7 @@ void LightscreenWindow::action(int mode)

void LightscreenWindow::areaHotkey()
{
screenshotAction(Screenshot::SelectedArea);
screenshotAction(Screenshot::Mode::M_SelectedArea);
}

void LightscreenWindow::checkForUpdates()
Expand Down Expand Up @@ -206,7 +206,7 @@ void LightscreenWindow::cleanup(const Screenshot::Options &options)
}

if (settings()->value("options/playSound", false).toBool()) {
if (options.result == Screenshot::Success) {
if (options.result == Screenshot::Result::R_Success) {
QSound::play("sounds/ls.screenshot.wav");
} else {
#ifdef Q_OS_WIN
Expand All @@ -220,7 +220,7 @@ void LightscreenWindow::cleanup(const Screenshot::Options &options)

updateStatus();

if (options.result != Screenshot::Success) {
if (options.result != Screenshot::Result::R_Success) {
return;
}

Expand Down Expand Up @@ -343,13 +343,13 @@ void LightscreenWindow::executeArgument(const QString &message)
os::setForegroundWindow(this);
qApp->alert(this, 2000);
} else if (message == "--screen") {
screenshotAction(Screenshot::WholeScreen);
screenshotAction(Screenshot::Mode::M_WholeScreen);
} else if (message == "--area") {
screenshotAction(Screenshot::SelectedArea);
screenshotAction(Screenshot::Mode::M_SelectedArea);
} else if (message == "--activewindow") {
screenshotAction(Screenshot::ActiveWindow);
screenshotAction(Screenshot::Mode::M_ActiveWindow);
} else if (message == "--pickwindow") {
screenshotAction(Screenshot::SelectedWindow);
screenshotAction(Screenshot::Mode::M_SelectedWindow);
} else if (message == "--folder") {
action(OpenScreenshotFolder);
} else if (message == "--uploadlast") {
Expand Down Expand Up @@ -379,7 +379,7 @@ void LightscreenWindow::executeArguments(const QStringList &arguments)
void LightscreenWindow::notify(const Screenshot::Result &result)
{
switch (result) {
case Screenshot::Success:
case Screenshot::Result::R_Success:
mTrayIcon->setIcon(QIcon(":/icons/lightscreen.yes"));

if (mHasTaskbarButton) {
Expand All @@ -388,7 +388,7 @@ void LightscreenWindow::notify(const Screenshot::Result &result)

setWindowTitle(tr("Success!"));
break;
case Screenshot::Failure:
case Screenshot::Result::R_Failure:
mTrayIcon->setIcon(QIcon(":/icons/lightscreen.no"));
setWindowTitle(tr("Failed!"));

Expand All @@ -397,7 +397,7 @@ void LightscreenWindow::notify(const Screenshot::Result &result)
}

break;
case Screenshot::Cancel:
case Screenshot::Result::R_Cancel:
setWindowTitle(tr("Cancelled!"));
break;
}
Expand Down Expand Up @@ -503,7 +503,7 @@ void LightscreenWindow::screenshotAction(Screenshot::Mode mode)
// The delayed functions works using the static variable lastMode
// which keeps the argument so a QTimer can call this function again.
if (delayms > 0) {
if (mLastMode == Screenshot::None) {
if (mLastMode == Screenshot::Mode::M_None) {
mLastMode = mode;

QTimer::singleShot(delayms, this, [&] {
Expand All @@ -512,7 +512,7 @@ void LightscreenWindow::screenshotAction(Screenshot::Mode mode)
return;
} else {
mode = mLastMode;
mLastMode = Screenshot::None;
mLastMode = Screenshot::Mode::M_None;
}
}

Expand Down Expand Up @@ -555,7 +555,7 @@ void LightscreenWindow::screenshotAction(Screenshot::Mode mode)
mDoCache = true;
}

options.mode = mode;
options.mode = static_cast<int>(mode);

ScreenshotManager::instance()->take(options);
}
Expand All @@ -567,7 +567,7 @@ void LightscreenWindow::screenshotActionTriggered(QAction *action)

void LightscreenWindow::screenHotkey()
{
screenshotAction(Screenshot::WholeScreen);
screenshotAction(Screenshot::Mode::M_WholeScreen);
}

void LightscreenWindow::showHotkeyError(const QStringList &hotkeys)
Expand Down Expand Up @@ -639,15 +639,15 @@ void LightscreenWindow::showOptions()

void LightscreenWindow::showScreenshotMessage(const Screenshot::Result &result, const QString &fileName)
{
if (result == Screenshot::Cancel) {
if (result == Screenshot::Result::R_Cancel) {
return;
}

// Showing message.
QString title;
QString message;

if (result == Screenshot::Success) {
if (result == Screenshot::Result::R_Success) {
title = QFileInfo(fileName).fileName();

if (settings()->value("file/target").toString().isEmpty()) {
Expand All @@ -673,7 +673,7 @@ void LightscreenWindow::showUploaderError(const QString &error)
mTrayIcon->showMessage(tr("Upload error"), error);
}

notify(Screenshot::Failure);
notify(Screenshot::Result::R_Failure);
}

void LightscreenWindow::showUploaderMessage(const QString &fileName, const QString &url)
Expand Down Expand Up @@ -813,12 +813,12 @@ void LightscreenWindow::uploadProgress(int progress)

void LightscreenWindow::windowHotkey()
{
screenshotAction(Screenshot::ActiveWindow);
screenshotAction(Screenshot::Mode::M_ActiveWindow);
}

void LightscreenWindow::windowPickerHotkey()
{
screenshotAction(Screenshot::SelectedWindow);
screenshotAction(Screenshot::Mode::M_SelectedWindow);
}

void LightscreenWindow::applySettings()
Expand Down Expand Up @@ -847,7 +847,7 @@ void LightscreenWindow::connectHotkeys()
{
const QStringList actions = {"screen", "window", "area", "windowPicker", "open", "directory"};
QStringList failed;
size_t id = Screenshot::WholeScreen;
size_t id = static_cast<size_t>(Screenshot::Mode::M_WholeScreen);

for (auto action : actions) {
if (settings()->value("actions/" + action + "/enabled").toBool()) {
Expand Down Expand Up @@ -879,16 +879,16 @@ void LightscreenWindow::createTrayIcon()
connect(hideAction, &QAction::triggered, this, &LightscreenWindow::toggleVisibility);

auto screenAction = new QAction(os::icon("screen"), tr("&Screen"), mTrayIcon);
screenAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::WholeScreen));
screenAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::Mode::M_WholeScreen));

auto windowAction = new QAction(os::icon("window"), tr("Active &Window"), this);
windowAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::ActiveWindow));
windowAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::Mode::M_ActiveWindow));

auto windowPickerAction = new QAction(os::icon("pickWindow"), tr("&Pick Window"), this);
windowPickerAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::SelectedWindow));
windowPickerAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::Mode::M_SelectedWindow));

auto areaAction = new QAction(os::icon("area"), tr("&Area"), mTrayIcon);
areaAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::SelectedArea));
areaAction->setData(QVariant::fromValue<Screenshot::Mode>(Screenshot::Mode::M_SelectedArea));

auto screenshotGroup = new QActionGroup(mTrayIcon);
screenshotGroup->addAction(screenAction);
Expand Down Expand Up @@ -975,7 +975,7 @@ bool LightscreenWindow::event(QEvent *event)
if (event->type() == QEvent::Show) {
QPoint savedPosition = settings()->value("position").toPoint();

if (!savedPosition.isNull() && qApp->desktop()->availableGeometry().contains(QRect(savedPosition, size()))) {
if (!savedPosition.isNull() && qApp->desktop()->screenGeometry(this).contains(QRect(savedPosition, size()))) {
move(savedPosition);
}

Expand Down
2 changes: 1 addition & 1 deletion lightscreenwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public slots:
void quit();
void restoreNotification();
void setStatus(QString status = "");
void screenshotAction(Screenshot::Mode mode = Screenshot::None);
void screenshotAction(Screenshot::Mode mode = Screenshot::Mode::M_None);
void screenshotActionTriggered(QAction *action);
void screenHotkey();
void showHotkeyError(const QStringList &hotkeys);
Expand Down
Loading