Skip to content

Commit aab70a6

Browse files
committed
More code style and some argument tweaks to functions.
1 parent 75c4bf9 commit aab70a6

19 files changed

+108
-111
lines changed

dialogs/areadialog.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AreaDialog : public QDialog
4242
Q_OBJECT
4343

4444
public:
45-
AreaDialog(Screenshot* screenshot);
45+
AreaDialog(Screenshot *screenshot);
4646
QRect &resultRect();
4747

4848
protected slots:
@@ -52,22 +52,22 @@ protected slots:
5252
void grabRect();
5353

5454
signals:
55-
void regionGrabbed( const QPixmap & );
55+
void regionGrabbed(const QPixmap &);
5656

5757
protected:
58-
void keyPressEvent( QKeyEvent* e );
59-
void mouseDoubleClickEvent( QMouseEvent* );
60-
void mouseMoveEvent( QMouseEvent* e );
61-
void mousePressEvent( QMouseEvent* e );
62-
void mouseReleaseEvent( QMouseEvent* e );
63-
void paintEvent( QPaintEvent* e );
64-
void resizeEvent( QResizeEvent* e );
65-
void showEvent( QShowEvent* e );
58+
void keyPressEvent(QKeyEvent *e);
59+
void mouseDoubleClickEvent(QMouseEvent *);
60+
void mouseMoveEvent(QMouseEvent *e);
61+
void mousePressEvent(QMouseEvent *e);
62+
void mouseReleaseEvent(QMouseEvent *e);
63+
void paintEvent(QPaintEvent *e);
64+
void resizeEvent(QResizeEvent *e);
65+
void showEvent(QShowEvent *e);
6666

6767
void updateHandles();
6868
QRegion handleMask() const;
6969

70-
QPoint limitPointToRect( const QPoint &p, const QRect &r ) const;
70+
QPoint limitPointToRect(const QPoint &p, const QRect &r) const;
7171

7272
bool mAutoclose;
7373
QPoint mDragStartPoint;
@@ -92,7 +92,7 @@ protected slots:
9292
QRect mTLHandle, mTRHandle, mBLHandle, mBRHandle;
9393
QRect mLHandle, mTHandle, mRHandle, mBHandle;
9494

95-
QVector<QRect*> mHandles;
95+
QVector<QRect *> mHandles;
9696
QPointer<QWidget> mAcceptWidget;
9797
};
9898

dialogs/historydialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void HistoryDialog::clear()
117117
close();
118118
}
119119

120-
void HistoryDialog::contextMenu(QPoint point)
120+
void HistoryDialog::contextMenu(const QPoint &point)
121121
{
122122
mContextIndex = ui->tableView->indexAt(point);;
123123

dialogs/historydialog.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <QItemSelection>
66

77
namespace Ui {
8-
class HistoryDialog;
8+
class HistoryDialog;
99
}
1010

1111
class QSqlTableModel;
@@ -15,32 +15,32 @@ class HistoryDialog : public QDialog
1515
Q_OBJECT
1616

1717
public:
18-
explicit HistoryDialog(QWidget *parent = 0);
19-
~HistoryDialog();
18+
explicit HistoryDialog(QWidget *parent = 0);
19+
~HistoryDialog();
2020

2121
private slots:
22-
void clear();
23-
void contextMenu(QPoint point);
24-
void copy();
25-
void deleteImage();
26-
void location();
27-
void removeHistoryEntry();
28-
void refresh();
29-
void open(const QModelIndex &index);
30-
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
31-
void upload();
32-
void uploadProgress(int progress);
22+
void clear();
23+
void contextMenu(const QPoint &point);
24+
void copy();
25+
void deleteImage();
26+
void location();
27+
void removeHistoryEntry();
28+
void refresh();
29+
void open(const QModelIndex &index);
30+
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
31+
void upload();
32+
void uploadProgress(int progress);
3333

3434
protected:
35-
bool eventFilter(QObject *object, QEvent *event);
36-
bool event(QEvent *event);
35+
bool eventFilter(QObject *object, QEvent *event);
36+
bool event(QEvent *event);
3737

3838
private:
39-
Ui::HistoryDialog *ui;
40-
QSqlTableModel *mModel;
41-
QSortFilterProxyModel *mFilterModel;
42-
QString mSelectedScreenshot;
43-
QModelIndex mContextIndex;
39+
Ui::HistoryDialog *ui;
40+
QSqlTableModel *mModel;
41+
QSortFilterProxyModel *mFilterModel;
42+
QString mSelectedScreenshot;
43+
QModelIndex mContextIndex;
4444
};
4545

4646
#endif // UPLOADDIALOG_H

dialogs/namingdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ NamingDialog::NamingDialog(Screenshot::Naming naming, QWidget *parent) :
6161
resize(minimumSizeHint());
6262
}
6363

64-
void NamingDialog::openUrl(QString url)
64+
void NamingDialog::openUrl(const QString &url)
6565
{
6666
QDesktopServices::openUrl(QUrl(url));
6767
}

dialogs/namingdialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class NamingDialog : public QDialog
3232
explicit NamingDialog(Screenshot::Naming naming, QWidget *parent = 0);
3333

3434
private slots:
35-
void openUrl(QString url);
36-
void saveSettings();
35+
void openUrl(const QString &url);
36+
void saveSettings();
3737

3838
protected:
39-
bool eventFilter(QObject *object, QEvent *event);
39+
bool eventFilter(QObject *object, QEvent *event);
4040

4141
private:
4242
Ui::NamingDialog ui;

dialogs/optionsdialog.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,38 @@ class OptionsDialog : public QDialog
3333
OptionsDialog(QWidget *parent = 0);
3434

3535
public slots:
36-
void accepted();
37-
void checkUpdatesNow();
38-
void exportSettings();
39-
void imgurAlbumList();
40-
void imgurAuthorize();
41-
void imgurRequestAlbumList();
42-
void imgurToken();
43-
void importSettings();
44-
void loadSettings();
45-
void openUrl(QString url);
46-
void restoreDefaults();
47-
void saveSettings();
48-
void updatePreview();
49-
void viewHistory();
36+
void accepted();
37+
void checkUpdatesNow();
38+
void exportSettings();
39+
void imgurAlbumList();
40+
void imgurAuthorize();
41+
void imgurRequestAlbumList();
42+
void imgurToken();
43+
void importSettings();
44+
void loadSettings();
45+
void openUrl(QString url);
46+
void restoreDefaults();
47+
void saveSettings();
48+
void updatePreview();
49+
void viewHistory();
5050

5151
protected:
52-
bool event(QEvent *event);
52+
bool event(QEvent *event);
5353

5454
#ifdef Q_OS_WIN
55-
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
55+
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
5656
#endif
5757

5858
private slots:
59-
void browse();
60-
void dialogButtonClicked(QAbstractButton *button);
61-
void flipToggled(bool checked);
62-
void init();
63-
void namingOptions();
59+
void browse();
60+
void dialogButtonClicked(QAbstractButton *button);
61+
void flipToggled(bool checked);
62+
void init();
63+
void namingOptions();
6464

6565
private:
66-
bool hotkeyCollision();
67-
QSettings *settings() const;
66+
bool hotkeyCollision();
67+
QSettings *settings() const;
6868

6969
private:
7070
Ui::OptionsDialog ui;

dialogs/previewdialog.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,41 @@ class PreviewDialog : public QDialog
2929
Q_OBJECT
3030

3131
public:
32-
PreviewDialog(QWidget *parent);
32+
PreviewDialog(QWidget *parent);
3333

34-
void add(Screenshot* screenshot);
35-
int count() const;
34+
void add(Screenshot *screenshot);
35+
int count() const;
3636

3737
public slots:
38-
void setWidth(int w) { resize(w, height()); }
39-
void setHeight(int h) { resize(width(), h); }
38+
void setWidth(int w) { resize(w, height()); }
39+
void setHeight(int h) { resize(width(), h); }
4040

4141
signals:
42-
void acceptAll();
43-
void rejectAll();
44-
void uploadAll();
42+
void acceptAll();
43+
void rejectAll();
44+
void uploadAll();
4545

4646
private slots:
47-
void closePreview();
48-
void enlargePreview();
49-
void indexChanged(int i);
50-
void next();
51-
void previous();
52-
void relocate();
47+
void closePreview();
48+
void enlargePreview();
49+
void indexChanged(int i);
50+
void next();
51+
void previous();
52+
void relocate();
5353

5454
protected:
55-
bool event(QEvent *event);
56-
void timerEvent(QTimerEvent *event);
55+
bool event(QEvent *event);
56+
void timerEvent(QTimerEvent *event);
5757

5858
private:
59-
int mAutoclose;
60-
int mAutocloseAction;
61-
int mAutocloseReset;
62-
int mPosition; //0: top left, 1: top right, 2: bottom left, 3: bottom rigth (default)
63-
int mSize;
64-
QPushButton* mNextButton;
65-
QPushButton* mPrevButton;
66-
QStackedLayout* mStack;
59+
int mAutoclose;
60+
int mAutocloseAction;
61+
int mAutocloseReset;
62+
int mPosition; //0: top left, 1: top right, 2: bottom left, 3: bottom rigth (default)
63+
int mSize;
64+
QPushButton *mNextButton;
65+
QPushButton *mPrevButton;
66+
QStackedLayout *mStack;
6767
};
6868

6969
#endif // PREVIEWDIALOG_H

dialogs/updaterdialog.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323

2424
class UpdaterDialog : public QProgressDialog
2525
{
26-
Q_OBJECT
26+
Q_OBJECT
2727

2828
public:
29-
UpdaterDialog(QWidget* parent = 0);
29+
UpdaterDialog(QWidget *parent = 0);
3030

3131
public slots:
32-
void updateDone(bool result);
32+
void updateDone(bool result);
3333

3434
private slots:
35-
void link(QString url);
35+
void link(QString url);
3636

3737
};
3838

lightscreenwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ void LightscreenWindow::showUploaderError(const QString &error)
675675
notify(Screenshot::Fail);
676676
}
677677

678-
void LightscreenWindow::showUploaderMessage(QString fileName, QString url)
678+
void LightscreenWindow::showUploaderMessage(const QString &fileName, const QString &url)
679679
{
680680
if (mTrayIcon && settings()->value("options/message").toBool() && !url.isEmpty()) {
681681
QString screenshot = QFileInfo(fileName).fileName();

lightscreenwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public slots:
6767
void showOptions();
6868
void showScreenshotMessage(const Screenshot::Result &result, const QString &fileName);
6969
void showUploaderError(const QString &error);
70-
void showUploaderMessage(QString fileName, QString url);
70+
void showUploaderMessage(const QString &fileName, const QString &url);
7171
void toggleVisibility(QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::DoubleClick);
7272
void updateStatus();
7373
void updaterDone(bool result);

tools/os.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ QGraphicsEffect *os::shadow(QColor color, int blurRadius, int offset)
291291
return shadowEffect;
292292
}
293293

294-
QIcon os::icon(QString name, QColor backgroundColor)
294+
QIcon os::icon(const QString &name, QColor backgroundColor)
295295
{
296296
if (!backgroundColor.isValid()) {
297297
backgroundColor = qApp->palette().color(QPalette::Button);

tools/os.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ void setStartup(bool startup, bool hide);
5555
// Creates a new QGraphicsDropShadowEffect to apply to widgets.
5656
QGraphicsEffect *shadow(QColor color = Qt::black, int blurRadius = 6, int offset = 1);
5757

58-
// Translates the ui to the given language name.
59-
void translate(QString language);
60-
6158
// Returns a QIcon for the given icon name (taking into account color schemes and whatnot).
62-
QIcon icon(QString name, QColor backgroundColor = QColor());
59+
QIcon icon(const QString &name, QColor backgroundColor = QColor());
6360

6461
// X11-specific functions for the Window Picker
6562
#if defined(Q_OS_LINUX)

tools/screenshot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ void Screenshot::save()
286286
}
287287
}
288288

289-
void Screenshot::setPixmap(QPixmap pixmap)
289+
void Screenshot::setPixmap(const QPixmap &pixmap)
290290
{
291291
mPixmap = pixmap;
292292

@@ -339,7 +339,7 @@ void Screenshot::upload()
339339
}
340340
}
341341

342-
void Screenshot::uploadDone(QString url)
342+
void Screenshot::uploadDone(const QString &url)
343343
{
344344
if (mOptions.imgurClipboard && !url.isEmpty()) {
345345
QApplication::clipboard()->setText(url, QClipboard::Clipboard);

tools/screenshot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ public slots:
104104
void optimize();
105105
void optimizationDone();
106106
void save();
107-
void setPixmap(QPixmap pixmap);
107+
void setPixmap(const QPixmap &pixmap);
108108
void take();
109109
void upload();
110-
void uploadDone(QString url);
110+
void uploadDone(const QString &url);
111111

112112
signals:
113113
void askConfirmation();

0 commit comments

Comments
 (0)