Skip to content

Commit

Permalink
More code style and some argument tweaks to functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaiser committed Mar 21, 2016
1 parent 75c4bf9 commit aab70a6
Show file tree
Hide file tree
Showing 19 changed files with 108 additions and 111 deletions.
24 changes: 12 additions & 12 deletions dialogs/areadialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AreaDialog : public QDialog
Q_OBJECT

public:
AreaDialog(Screenshot* screenshot);
AreaDialog(Screenshot *screenshot);
QRect &resultRect();

protected slots:
Expand All @@ -52,22 +52,22 @@ protected slots:
void grabRect();

signals:
void regionGrabbed( const QPixmap & );
void regionGrabbed(const QPixmap &);

protected:
void keyPressEvent( QKeyEvent* e );
void mouseDoubleClickEvent( QMouseEvent* );
void mouseMoveEvent( QMouseEvent* e );
void mousePressEvent( QMouseEvent* e );
void mouseReleaseEvent( QMouseEvent* e );
void paintEvent( QPaintEvent* e );
void resizeEvent( QResizeEvent* e );
void showEvent( QShowEvent* e );
void keyPressEvent(QKeyEvent *e);
void mouseDoubleClickEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
void showEvent(QShowEvent *e);

void updateHandles();
QRegion handleMask() const;

QPoint limitPointToRect( const QPoint &p, const QRect &r ) const;
QPoint limitPointToRect(const QPoint &p, const QRect &r) const;

bool mAutoclose;
QPoint mDragStartPoint;
Expand All @@ -92,7 +92,7 @@ protected slots:
QRect mTLHandle, mTRHandle, mBLHandle, mBRHandle;
QRect mLHandle, mTHandle, mRHandle, mBHandle;

QVector<QRect*> mHandles;
QVector<QRect *> mHandles;
QPointer<QWidget> mAcceptWidget;
};

Expand Down
2 changes: 1 addition & 1 deletion dialogs/historydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void HistoryDialog::clear()
close();
}

void HistoryDialog::contextMenu(QPoint point)
void HistoryDialog::contextMenu(const QPoint &point)
{
mContextIndex = ui->tableView->indexAt(point);;

Expand Down
42 changes: 21 additions & 21 deletions dialogs/historydialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QItemSelection>

namespace Ui {
class HistoryDialog;
class HistoryDialog;
}

class QSqlTableModel;
Expand All @@ -15,32 +15,32 @@ class HistoryDialog : public QDialog
Q_OBJECT

public:
explicit HistoryDialog(QWidget *parent = 0);
~HistoryDialog();
explicit HistoryDialog(QWidget *parent = 0);
~HistoryDialog();

private slots:
void clear();
void contextMenu(QPoint point);
void copy();
void deleteImage();
void location();
void removeHistoryEntry();
void refresh();
void open(const QModelIndex &index);
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void upload();
void uploadProgress(int progress);
void clear();
void contextMenu(const QPoint &point);
void copy();
void deleteImage();
void location();
void removeHistoryEntry();
void refresh();
void open(const QModelIndex &index);
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void upload();
void uploadProgress(int progress);

protected:
bool eventFilter(QObject *object, QEvent *event);
bool event(QEvent *event);
bool eventFilter(QObject *object, QEvent *event);
bool event(QEvent *event);

private:
Ui::HistoryDialog *ui;
QSqlTableModel *mModel;
QSortFilterProxyModel *mFilterModel;
QString mSelectedScreenshot;
QModelIndex mContextIndex;
Ui::HistoryDialog *ui;
QSqlTableModel *mModel;
QSortFilterProxyModel *mFilterModel;
QString mSelectedScreenshot;
QModelIndex mContextIndex;
};

#endif // UPLOADDIALOG_H
2 changes: 1 addition & 1 deletion dialogs/namingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ NamingDialog::NamingDialog(Screenshot::Naming naming, QWidget *parent) :
resize(minimumSizeHint());
}

void NamingDialog::openUrl(QString url)
void NamingDialog::openUrl(const QString &url)
{
QDesktopServices::openUrl(QUrl(url));
}
Expand Down
6 changes: 3 additions & 3 deletions dialogs/namingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class NamingDialog : public QDialog
explicit NamingDialog(Screenshot::Naming naming, QWidget *parent = 0);

private slots:
void openUrl(QString url);
void saveSettings();
void openUrl(const QString &url);
void saveSettings();

protected:
bool eventFilter(QObject *object, QEvent *event);
bool eventFilter(QObject *object, QEvent *event);

private:
Ui::NamingDialog ui;
Expand Down
46 changes: 23 additions & 23 deletions dialogs/optionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,38 @@ class OptionsDialog : public QDialog
OptionsDialog(QWidget *parent = 0);

public slots:
void accepted();
void checkUpdatesNow();
void exportSettings();
void imgurAlbumList();
void imgurAuthorize();
void imgurRequestAlbumList();
void imgurToken();
void importSettings();
void loadSettings();
void openUrl(QString url);
void restoreDefaults();
void saveSettings();
void updatePreview();
void viewHistory();
void accepted();
void checkUpdatesNow();
void exportSettings();
void imgurAlbumList();
void imgurAuthorize();
void imgurRequestAlbumList();
void imgurToken();
void importSettings();
void loadSettings();
void openUrl(QString url);
void restoreDefaults();
void saveSettings();
void updatePreview();
void viewHistory();

protected:
bool event(QEvent *event);
bool event(QEvent *event);

#ifdef Q_OS_WIN
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
#endif

private slots:
void browse();
void dialogButtonClicked(QAbstractButton *button);
void flipToggled(bool checked);
void init();
void namingOptions();
void browse();
void dialogButtonClicked(QAbstractButton *button);
void flipToggled(bool checked);
void init();
void namingOptions();

private:
bool hotkeyCollision();
QSettings *settings() const;
bool hotkeyCollision();
QSettings *settings() const;

private:
Ui::OptionsDialog ui;
Expand Down
48 changes: 24 additions & 24 deletions dialogs/previewdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,41 @@ class PreviewDialog : public QDialog
Q_OBJECT

public:
PreviewDialog(QWidget *parent);
PreviewDialog(QWidget *parent);

void add(Screenshot* screenshot);
int count() const;
void add(Screenshot *screenshot);
int count() const;

public slots:
void setWidth(int w) { resize(w, height()); }
void setHeight(int h) { resize(width(), h); }
void setWidth(int w) { resize(w, height()); }
void setHeight(int h) { resize(width(), h); }

signals:
void acceptAll();
void rejectAll();
void uploadAll();
void acceptAll();
void rejectAll();
void uploadAll();

private slots:
void closePreview();
void enlargePreview();
void indexChanged(int i);
void next();
void previous();
void relocate();
void closePreview();
void enlargePreview();
void indexChanged(int i);
void next();
void previous();
void relocate();

protected:
bool event(QEvent *event);
void timerEvent(QTimerEvent *event);
bool event(QEvent *event);
void timerEvent(QTimerEvent *event);

private:
int mAutoclose;
int mAutocloseAction;
int mAutocloseReset;
int mPosition; //0: top left, 1: top right, 2: bottom left, 3: bottom rigth (default)
int mSize;
QPushButton* mNextButton;
QPushButton* mPrevButton;
QStackedLayout* mStack;
int mAutoclose;
int mAutocloseAction;
int mAutocloseReset;
int mPosition; //0: top left, 1: top right, 2: bottom left, 3: bottom rigth (default)
int mSize;
QPushButton *mNextButton;
QPushButton *mPrevButton;
QStackedLayout *mStack;
};

#endif // PREVIEWDIALOG_H
8 changes: 4 additions & 4 deletions dialogs/updaterdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

class UpdaterDialog : public QProgressDialog
{
Q_OBJECT
Q_OBJECT

public:
UpdaterDialog(QWidget* parent = 0);
UpdaterDialog(QWidget *parent = 0);

public slots:
void updateDone(bool result);
void updateDone(bool result);

private slots:
void link(QString url);
void link(QString url);

};

Expand Down
2 changes: 1 addition & 1 deletion lightscreenwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ void LightscreenWindow::showUploaderError(const QString &error)
notify(Screenshot::Fail);
}

void LightscreenWindow::showUploaderMessage(QString fileName, QString url)
void LightscreenWindow::showUploaderMessage(const QString &fileName, const QString &url)
{
if (mTrayIcon && settings()->value("options/message").toBool() && !url.isEmpty()) {
QString screenshot = QFileInfo(fileName).fileName();
Expand Down
2 changes: 1 addition & 1 deletion lightscreenwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public slots:
void showOptions();
void showScreenshotMessage(const Screenshot::Result &result, const QString &fileName);
void showUploaderError(const QString &error);
void showUploaderMessage(QString fileName, QString url);
void showUploaderMessage(const QString &fileName, const QString &url);
void toggleVisibility(QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::DoubleClick);
void updateStatus();
void updaterDone(bool result);
Expand Down
2 changes: 1 addition & 1 deletion tools/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ QGraphicsEffect *os::shadow(QColor color, int blurRadius, int offset)
return shadowEffect;
}

QIcon os::icon(QString name, QColor backgroundColor)
QIcon os::icon(const QString &name, QColor backgroundColor)
{
if (!backgroundColor.isValid()) {
backgroundColor = qApp->palette().color(QPalette::Button);
Expand Down
5 changes: 1 addition & 4 deletions tools/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ void setStartup(bool startup, bool hide);
// Creates a new QGraphicsDropShadowEffect to apply to widgets.
QGraphicsEffect *shadow(QColor color = Qt::black, int blurRadius = 6, int offset = 1);

// Translates the ui to the given language name.
void translate(QString language);

// Returns a QIcon for the given icon name (taking into account color schemes and whatnot).
QIcon icon(QString name, QColor backgroundColor = QColor());
QIcon icon(const QString &name, QColor backgroundColor = QColor());

// X11-specific functions for the Window Picker
#if defined(Q_OS_LINUX)
Expand Down
4 changes: 2 additions & 2 deletions tools/screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void Screenshot::save()
}
}

void Screenshot::setPixmap(QPixmap pixmap)
void Screenshot::setPixmap(const QPixmap &pixmap)
{
mPixmap = pixmap;

Expand Down Expand Up @@ -339,7 +339,7 @@ void Screenshot::upload()
}
}

void Screenshot::uploadDone(QString url)
void Screenshot::uploadDone(const QString &url)
{
if (mOptions.imgurClipboard && !url.isEmpty()) {
QApplication::clipboard()->setText(url, QClipboard::Clipboard);
Expand Down
4 changes: 2 additions & 2 deletions tools/screenshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ public slots:
void optimize();
void optimizationDone();
void save();
void setPixmap(QPixmap pixmap);
void setPixmap(const QPixmap &pixmap);
void take();
void upload();
void uploadDone(QString url);
void uploadDone(const QString &url);

signals:
void askConfirmation();
Expand Down
Loading

0 comments on commit aab70a6

Please sign in to comment.