mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Random whitespace update
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d6d82a5af8
commit
0d1da0563b
7 changed files with 62 additions and 56 deletions
|
@ -209,7 +209,7 @@ void DiveListView::unselectDives()
|
|||
// would only cause pointless churn
|
||||
int i;
|
||||
struct dive *dive;
|
||||
for_each_dive(i, dive) {
|
||||
for_each_dive (i, dive) {
|
||||
dive->selected = false;
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS
|
|||
QTreeView::selectionChanged(selectionModel()->selection(), newDeselected);
|
||||
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection)));
|
||||
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex)));
|
||||
if(!dontEmitDiveChangedSignal)
|
||||
if (!dontEmitDiveChangedSignal)
|
||||
Q_EMIT currentDiveChanged(selected_dive);
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ void DiveListView::loadImages()
|
|||
shiftDialog.exec();
|
||||
updateLastImageTimeOffset(shiftDialog.amount());
|
||||
|
||||
Q_FOREACH(const QString& fileName, fileNames) {
|
||||
Q_FOREACH (const QString &fileName, fileNames) {
|
||||
int j = 0;
|
||||
struct dive *dive;
|
||||
for_each_dive (j, dive) {
|
||||
|
|
|
@ -124,7 +124,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
memset(&what, 0, sizeof(what));
|
||||
|
||||
QToolBar *toolBar = new QToolBar();
|
||||
Q_FOREACH(QAction *a, profileToolbarActions)
|
||||
Q_FOREACH (QAction *a, profileToolbarActions)
|
||||
toolBar->addAction(a);
|
||||
toolBar->setOrientation(Qt::Vertical);
|
||||
|
||||
|
@ -133,7 +133,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
// I need to take the current item that's in the toolbar Position
|
||||
// and reposition it alongside the grid layout.
|
||||
QLayoutItem *p = ui.gridLayout->takeAt(0);
|
||||
ui.gridLayout->addWidget(toolBar,0,0);
|
||||
ui.gridLayout->addWidget(toolBar, 0, 0);
|
||||
ui.gridLayout->addItem(p, 0, 1);
|
||||
}
|
||||
|
||||
|
@ -499,10 +499,10 @@ void MainWindow::on_actionDivePlanner_triggered()
|
|||
|
||||
void MainWindow::on_actionAddDive_triggered()
|
||||
{
|
||||
if(!plannerStateClean())
|
||||
if (!plannerStateClean())
|
||||
return;
|
||||
|
||||
if (dive_list()->selectedTrips().count() >= 1){
|
||||
if (dive_list()->selectedTrips().count() >= 1) {
|
||||
dive_list()->rememberSelection();
|
||||
dive_list()->clearSelection();
|
||||
}
|
||||
|
@ -1257,18 +1257,18 @@ void MainWindow::editCurrentDive()
|
|||
}
|
||||
}
|
||||
|
||||
#define PREF_PROFILE(QT_PREFS) \
|
||||
QSettings s; \
|
||||
s.beginGroup("TecDetails"); \
|
||||
#define PREF_PROFILE(QT_PREFS) \
|
||||
QSettings s; \
|
||||
s.beginGroup("TecDetails"); \
|
||||
s.setValue(#QT_PREFS, triggered); \
|
||||
PreferencesDialog::instance()->emitSettingsChanged();
|
||||
|
||||
#define TOOLBOX_PREF_PROFILE(METHOD, INTERNAL_PREFS, QT_PREFS) \
|
||||
void MainWindow::on_ ## METHOD ##_triggered(bool triggered) \
|
||||
{ \
|
||||
prefs. INTERNAL_PREFS = triggered;\
|
||||
PREF_PROFILE(QT_PREFS); \
|
||||
}
|
||||
#define TOOLBOX_PREF_PROFILE(METHOD, INTERNAL_PREFS, QT_PREFS) \
|
||||
void MainWindow::on_##METHOD##_triggered(bool triggered) \
|
||||
{ \
|
||||
prefs.INTERNAL_PREFS = triggered; \
|
||||
PREF_PROFILE(QT_PREFS); \
|
||||
}
|
||||
|
||||
TOOLBOX_PREF_PROFILE(profCalcAllTissues, calcalltissues, calcalltissues);
|
||||
TOOLBOX_PREF_PROFILE(profCalcCeiling, calcceiling, calcceiling);
|
||||
|
@ -1311,7 +1311,7 @@ void MainWindow::on_actionConfigure_Dive_Computer_triggered()
|
|||
|
||||
void MainWindow::setEnabledToolbar(bool arg1)
|
||||
{
|
||||
Q_FOREACH(QAction *b, profileToolbarActions)
|
||||
Q_FOREACH (QAction *b, profileToolbarActions)
|
||||
b->setEnabled(arg1);
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ private:
|
|||
QDialog *survey;
|
||||
struct dive copyPasteDive;
|
||||
struct dive_components what;
|
||||
QList<QAction*> profileToolbarActions;
|
||||
QList<QAction *> profileToolbarActions;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -267,7 +267,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
|
|||
cyl->gasmix.o2 = string_to_fraction(vString.toUtf8().data());
|
||||
pressure_t modpO2;
|
||||
modpO2.mbar = prefs.decopo2;
|
||||
cyl->depth = gas_mod(&cyl->gasmix, modpO2, M_OR_FT(3,10));
|
||||
cyl->depth = gas_mod(&cyl->gasmix, modpO2, M_OR_FT(3, 10));
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
@ -378,8 +378,8 @@ void CylindersModel::remove(const QModelIndex &index)
|
|||
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&
|
||||
(cyl->manually_added || is_cylinder_used(&displayed_dive, index.row()))))) {
|
||||
QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT(
|
||||
tr("Cylinder cannot be removed"),
|
||||
tr("This gas is in use. Only cylinders that are not used in the dive can be removed.")),
|
||||
tr("Cylinder cannot be removed"),
|
||||
tr("This gas is in use. Only cylinders that are not used in the dive can be removed.")),
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
@ -2101,7 +2101,7 @@ int LanguageModel::rowCount(const QModelIndex &parent) const
|
|||
}
|
||||
|
||||
|
||||
TagFilterModel::TagFilterModel(QObject *parent): QStringListModel(parent), checkState(NULL)
|
||||
TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent), checkState(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2113,7 +2113,7 @@ TagFilterModel *TagFilterModel::instance()
|
|||
|
||||
QVariant TagFilterModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(role == Qt::CheckStateRole){
|
||||
if (role == Qt::CheckStateRole) {
|
||||
return checkState[index.row()] ? Qt::Checked : Qt::Unchecked;
|
||||
} else if (role == Qt::DisplayRole) {
|
||||
return stringList()[index.row()];
|
||||
|
@ -2141,32 +2141,32 @@ void TagFilterModel::repopulate()
|
|||
delete[] checkState;
|
||||
checkState = new bool[list.count()];
|
||||
memset(checkState, true, list.count());
|
||||
checkState[list.count()-1] = true;
|
||||
checkState[list.count() - 1] = true;
|
||||
}
|
||||
|
||||
bool TagFilterModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(role == Qt::CheckStateRole){
|
||||
if (role == Qt::CheckStateRole) {
|
||||
checkState[index.row()] = value.toBool();
|
||||
dataChanged(index,index);
|
||||
dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
TagFilterSortModel::TagFilterSortModel(QObject *parent): QSortFilterProxyModel(parent)
|
||||
TagFilterSortModel::TagFilterSortModel(QObject *parent) : QSortFilterProxyModel(parent)
|
||||
{
|
||||
connect(TagFilterModel::instance(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(invalidate()));
|
||||
connect(TagFilterModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(invalidate()));
|
||||
}
|
||||
|
||||
bool TagFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||
{
|
||||
QModelIndex index0 = sourceModel()->index(source_row, 0, source_parent);
|
||||
QVariant diveVariant = sourceModel()->data(index0, DiveTripModel::DIVE_ROLE);
|
||||
struct dive* d = (struct dive* ) diveVariant.value<void*>();
|
||||
struct dive *d = (struct dive *)diveVariant.value<void *>();
|
||||
|
||||
if (!d) { // It's a trip, only show the ones that have dives to be shown.
|
||||
for(int i = 0; i < sourceModel()->rowCount(index0); i++){
|
||||
for (int i = 0; i < sourceModel()->rowCount(index0); i++) {
|
||||
if (filterAcceptsRow(i, index0))
|
||||
return true;
|
||||
}
|
||||
|
@ -2175,14 +2175,14 @@ bool TagFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &sou
|
|||
// Checked means 'Show', Unchecked means 'Hide'.
|
||||
struct tag_entry *head = d->tag_list;
|
||||
|
||||
if (!head){ // last tag means "Show empty tags";
|
||||
return TagFilterModel::instance()->checkState[TagFilterModel::instance()->rowCount()-1];
|
||||
if (!head) { // last tag means "Show empty tags";
|
||||
return TagFilterModel::instance()->checkState[TagFilterModel::instance()->rowCount() - 1];
|
||||
}
|
||||
|
||||
// have at least one tag.
|
||||
QStringList tagList = TagFilterModel::instance()->stringList();
|
||||
tagList.removeLast(); // remove the "Show Empty Tags";
|
||||
while(head) {
|
||||
while (head) {
|
||||
QString tagName(head->tag->name);
|
||||
int index = tagList.indexOf(tagName);
|
||||
if (TagFilterModel::instance()->checkState[index])
|
||||
|
|
|
@ -425,8 +425,10 @@ public:
|
|||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool *checkState;
|
||||
public slots:
|
||||
public
|
||||
slots:
|
||||
void repopulate();
|
||||
|
||||
private:
|
||||
explicit TagFilterModel(QObject *parent = 0);
|
||||
};
|
||||
|
|
|
@ -296,7 +296,7 @@ DateWidget::DateWidget(QWidget *parent) : QWidget(parent),
|
|||
calendarWidget(new QCalendarWidget())
|
||||
{
|
||||
setDate(QDate::currentDate());
|
||||
setMinimumSize(QSize(80,64));
|
||||
setMinimumSize(QSize(80, 64));
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
calendarWidget->setWindowFlags(Qt::FramelessWindowHint);
|
||||
calendarWidget->setFirstDayOfWeek(getLocale().firstDayOfWeek());
|
||||
|
@ -311,13 +311,13 @@ DateWidget::DateWidget(QWidget *parent) : QWidget(parent),
|
|||
|
||||
bool DateWidget::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::FocusOut){
|
||||
if (event->type() == QEvent::FocusOut) {
|
||||
calendarWidget->hide();
|
||||
return true;
|
||||
}
|
||||
if(event->type() == QEvent::KeyPress){
|
||||
QKeyEvent *ev = static_cast<QKeyEvent*>(event);
|
||||
if(ev->key() == Qt::Key_Escape){
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ev = static_cast<QKeyEvent *>(event);
|
||||
if (ev->key() == Qt::Key_Escape) {
|
||||
calendarWidget->hide();
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ bool DateWidget::eventFilter(QObject *object, QEvent *event)
|
|||
}
|
||||
|
||||
|
||||
void DateWidget::setDate(const QDate& date)
|
||||
void DateWidget::setDate(const QDate &date)
|
||||
{
|
||||
mDate = date;
|
||||
update();
|
||||
|
@ -339,7 +339,7 @@ QDate DateWidget::date() const
|
|||
|
||||
void DateWidget::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::EnabledChange){
|
||||
if (event->type() == QEvent::EnabledChange) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -347,11 +347,11 @@ void DateWidget::changeEvent(QEvent *event)
|
|||
#define DATEWIDGETWIDTH 80
|
||||
void DateWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
static QPixmap pix = QPixmap(":/calendar").scaled(DATEWIDGETWIDTH,64);
|
||||
static QPixmap pix = QPixmap(":/calendar").scaled(DATEWIDGETWIDTH, 64);
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
painter.drawPixmap(QPoint(0,0), isEnabled() ? pix : QPixmap::fromImage(grayImage(pix.toImage())));
|
||||
painter.drawPixmap(QPoint(0, 0), isEnabled() ? pix : QPixmap::fromImage(grayImage(pix.toImage())));
|
||||
|
||||
QString month = mDate.toString("MMM");
|
||||
QString year = mDate.toString("yyyy");
|
||||
|
@ -367,7 +367,7 @@ void DateWidget::paintEvent(QPaintEvent *event)
|
|||
|
||||
font.setPointSize(14);
|
||||
metrics = QFontMetrics(font);
|
||||
painter.setPen(QPen(QBrush(Qt::black),0));
|
||||
painter.setPen(QPen(QBrush(Qt::black), 0));
|
||||
painter.setBrush(Qt::black);
|
||||
painter.setFont(font);
|
||||
painter.drawText(QPoint(DATEWIDGETWIDTH / 2 - metrics.width(day) / 2, 45), day);
|
||||
|
@ -402,13 +402,13 @@ void DateWidget::focusOutEvent(QFocusEvent *event)
|
|||
|
||||
void DateWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if ( event->key() == Qt::Key_Return ||
|
||||
event->key() == Qt::Key_Enter ||
|
||||
event->key() == Qt::Key_Space){
|
||||
calendarWidget->move(mapToGlobal(QPoint(0,64)));
|
||||
if (event->key() == Qt::Key_Return ||
|
||||
event->key() == Qt::Key_Enter ||
|
||||
event->key() == Qt::Key_Space) {
|
||||
calendarWidget->move(mapToGlobal(QPoint(0, 64)));
|
||||
calendarWidget->show();
|
||||
event->setAccepted(true);
|
||||
}else{
|
||||
} else {
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -416,8 +416,7 @@ void DateWidget::keyPressEvent(QKeyEvent *event)
|
|||
#define COMPONENT_FROM_UI(_component) what->_component = ui._component->isChecked()
|
||||
#define UI_FROM_COMPONENT(_component) ui._component->setChecked(what->_component)
|
||||
|
||||
DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *target, struct dive_components *_what):
|
||||
targetDive(target)
|
||||
DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *target, struct dive_components *_what) : targetDive(target)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
what = _what;
|
||||
|
@ -457,7 +456,7 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
|
|||
}
|
||||
}
|
||||
|
||||
TagFilter::TagFilter(QWidget *parent): QWidget(parent)
|
||||
TagFilter::TagFilter(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
QSortFilterProxyModel *filter = new QSortFilterProxyModel();
|
||||
|
|
|
@ -96,8 +96,10 @@ class DateWidget : public QWidget {
|
|||
public:
|
||||
DateWidget(QWidget *parent = 0);
|
||||
QDate date() const;
|
||||
public slots:
|
||||
void setDate(const QDate& date);
|
||||
public
|
||||
slots:
|
||||
void setDate(const QDate &date);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
@ -107,7 +109,8 @@ protected:
|
|||
void changeEvent(QEvent *);
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
signals:
|
||||
void dateChanged(const QDate& date);
|
||||
void dateChanged(const QDate &date);
|
||||
|
||||
private:
|
||||
QDate mDate;
|
||||
QCalendarWidget *calendarWidget;
|
||||
|
@ -120,6 +123,7 @@ public:
|
|||
private
|
||||
slots:
|
||||
void buttonClicked(QAbstractButton *button);
|
||||
|
||||
private:
|
||||
Ui::DiveComponentSelectionDialog ui;
|
||||
struct dive *targetDive;
|
||||
|
@ -130,11 +134,12 @@ class TagFilter : public QWidget {
|
|||
Q_OBJECT
|
||||
public:
|
||||
TagFilter(QWidget *parent = 0);
|
||||
|
||||
private:
|
||||
Ui::TagFilter ui;
|
||||
};
|
||||
|
||||
bool isGnome3Session();
|
||||
QImage grayImage(const QImage& coloredImg);
|
||||
QImage grayImage(const QImage &coloredImg);
|
||||
|
||||
#endif // SIMPLEWIDGETS_H
|
||||
|
|
Loading…
Add table
Reference in a new issue