Skip to content

Commit 2ca10c1

Browse files
committed
Refactoring: max code length
1 parent 9b2345f commit 2ca10c1

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

src/capslockeventfilter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ bool CapsLockEventFilter::keyEvent(QKeyEvent* event)
6464

6565
if (m_capsLockEnable && !event->text().isEmpty()) {
6666
if (event->text().at(0).isLower() && (event->modifiers() == Qt::NoModifier)) {
67-
QApplication::sendEvent(parent(), new QKeyEvent(QEvent::KeyPress, event->key(), Qt::NoModifier, event->text().toUpper(), false, 1));
67+
QApplication::sendEvent(parent(), new QKeyEvent(QEvent::KeyPress, event->key(), Qt::NoModifier, event->text().toUpper(),
68+
false, 1));
6869
return true;
6970
}
7071

7172
if (event->text().at(0).isUpper() && (event->modifiers() == Qt::ShiftModifier)) {
72-
QApplication::sendEvent(parent(), new QKeyEvent(QEvent::KeyPress, event->key(), Qt::ShiftModifier, event->text().toLower(), false, 1));
73+
QApplication::sendEvent(parent(), new QKeyEvent(QEvent::KeyPress, event->key(), Qt::ShiftModifier,
74+
event->text().toLower(), false, 1));
7375
return true;
7476
}
7577
}

src/document.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ void Document::setWidget(QWidget* widget)
153153
m_widget->setAutoFillBackground(true);
154154

155155
DocumentWidgetCloseEventFilter* filter = new DocumentWidgetCloseEventFilter(m_widget);
156-
connect(filter, SIGNAL(closeRequested(QCloseEvent*)), this, SLOT(closeEvent(QCloseEvent*)), Qt::ConnectionType::DirectConnection);
156+
connect(filter, SIGNAL(closeRequested(QCloseEvent*)), this, SLOT(closeEvent(QCloseEvent*)),
157+
Qt::ConnectionType::DirectConnection);
157158
m_widget->installEventFilter(filter);
158159
}
159160

src/documentmanager.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,21 @@ DocumentWidgetProperties::Ptr DocumentManager::createDocumentWidgetProperties(co
276276
void DocumentManager::addDocument(Document* document, const QString& id)
277277
{
278278
document->setParent(this);
279-
connect(document, SIGNAL(closeRequested(Document*)), this, SLOT(documentCloseRequest(Document*)), Qt::ConnectionType::DirectConnection);
279+
connect(document, SIGNAL(closeRequested(Document*)), this, SLOT(documentCloseRequest(Document*)),
280+
Qt::ConnectionType::DirectConnection);
280281
connect(document, SIGNAL(closed(Document*)), this, SLOT(removeDocument(Document*)));
281282
connect(document, SIGNAL(closed(Document*)), this, SLOT(documentClosed(Document*)));
282-
connect(document, SIGNAL(modificationChanged(Document*, bool)), this, SLOT(documentModificationChanged(Document*, bool)));
283+
connect(document, SIGNAL(modificationChanged(Document*, bool)), this, SLOT(documentModificationChanged(Document*,
284+
bool)));
283285
connect(document, SIGNAL(cursorPositionChanged(Document*)), this, SLOT(documentCursorPositionChanged(Document*)));
284286
connect(document, SIGNAL(selectionChanged(Document*)), this, SLOT(documentSelectionChanged(Document*)));
285287
connect(document, SIGNAL(briefChanged(Document*)), this, SLOT(documentBriefChanged(Document*)));
286288
connect(document, SIGNAL(redoAvailable(Document*, bool)), this, SLOT(documentRedoAvailable(Document*, bool)));
287289
connect(document, SIGNAL(undoAvailable(Document*, bool)), this, SLOT(documentUndoAvailable(Document*, bool)));
288-
connect(document, SIGNAL(customContextMenuRequested(Document*, const QPoint&)), this, SLOT(customContextMenuRequest(Document*, const QPoint&)));
289-
connect(document, SIGNAL(fileWatchRequested(const QString&, bool)), this, SLOT(documentFileWatchRequest(const QString&, bool)));
290+
connect(document, SIGNAL(customContextMenuRequested(Document*, const QPoint&)), this,
291+
SLOT(customContextMenuRequest(Document*, const QPoint&)));
292+
connect(document, SIGNAL(fileWatchRequested(const QString&, bool)), this, SLOT(documentFileWatchRequest(const QString&,
293+
bool)));
290294

291295
DocumentListItem item;
292296
item.document = document;

src/documentproducer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ bool DocumentProducer::setDocumentStyle(const DocumentStyle::Ptr& style)
5353
}
5454

5555
if (style->documentType() != documentType()) {
56-
qWarning() << "DocumentProducer::setDocumentStyle() : The object \"style\" has the inappropriate type" << style->documentType();
56+
qWarning() << "DocumentProducer::setDocumentStyle() : The object \"style\" has the inappropriate type" <<
57+
style->documentType();
5758
return false;
5859
}
5960

@@ -74,7 +75,8 @@ bool DocumentProducer::setDocumentWidgetProperties(const DocumentWidgetPropertie
7475
}
7576

7677
if (properties->documentType() != documentType()) {
77-
qWarning() << "DocumentProducer::setDocumentWidgetProperties() : The object \"properties\" has the inappropriate type" << properties->documentType();
78+
qWarning() << "DocumentProducer::setDocumentWidgetProperties() : The object \"properties\" has the inappropriate type"
79+
<< properties->documentType();
7880
return false;
7981
}
8082

src/edytornc.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@ EdytorNc::EdytorNc(Medium* medium)
190190
connect(m_documentManager, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));
191191
connect(m_documentManager, SIGNAL(briefChanged(Document*)), this, SLOT(updateOpenFileList()));
192192
connect(m_documentManager, SIGNAL(documentListChanged()), this, SLOT(updateOpenFileList()));
193-
connect(m_documentManager, SIGNAL(closeRequested(Document*)), this, SLOT(maybeSave(Document*)), Qt::ConnectionType::DirectConnection);
193+
connect(m_documentManager, SIGNAL(closeRequested(Document*)), this, SLOT(maybeSave(Document*)),
194+
Qt::ConnectionType::DirectConnection);
194195
connect(m_documentManager, SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool)));
195196
connect(m_documentManager, SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool)));
196-
connect(m_documentManager, SIGNAL(customContextMenuRequested(Document*, const QPoint&)), this, SLOT(customContextMenuRequest(Document*, const QPoint&)));
197+
connect(m_documentManager, SIGNAL(customContextMenuRequested(Document*, const QPoint&)), this,
198+
SLOT(customContextMenuRequest(Document*, const QPoint&)));
197199
connect(m_documentManager, SIGNAL(fileWatchRequest(const QString&, bool)), this, SLOT(watchFile(const QString&, bool)));
198200

199201
m_sessionManager = new SessionManager(m_documentManager, this);
@@ -889,7 +891,8 @@ void EdytorNc::config()
889891
if (setUpDialog->exec() == QDialog::Accepted) {
890892
config = setUpDialog->getSettings();
891893
QSettings* cfg = Medium::instance().settings();
892-
m_documentManager->setDocumentWidgetProperties(DocumentWidgetProperties::Ptr(new GCoderWidgetProperties(config.editorProperties)));
894+
m_documentManager->setDocumentWidgetProperties(DocumentWidgetProperties::Ptr(new GCoderWidgetProperties(
895+
config.editorProperties)));
893896
config.editorProperties.save(cfg);
894897
emit intCapsLockChanged(config.editorProperties.intCapsLock);
895898
m_documentManager->setDocumentStyle(DocumentStyle::Ptr(new GCoderStyle(config.codeStyle)));
@@ -2233,7 +2236,8 @@ void EdytorNc::createFindToolBar()
22332236
CapsLockEventFilter* findEditEventFilter = new CapsLockEventFilter(findEdit);
22342237
connect(this, SIGNAL(intCapsLockChanged(bool)), findEditEventFilter, SLOT(setCapsLockEnable(bool)));
22352238
bool intCapsLock = false;
2236-
GCoderWidgetProperties* prop = dynamic_cast<GCoderWidgetProperties*>(m_documentManager->documentWidgetProperties(GCoder::DOCUMENT_TYPE).get());
2239+
GCoderWidgetProperties* prop = dynamic_cast<GCoderWidgetProperties*>(m_documentManager->documentWidgetProperties(
2240+
GCoder::DOCUMENT_TYPE).get());
22372241

22382242
if (prop) {
22392243
intCapsLock = prop->intCapsLock;

src/gcoderdocument.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ GCoderDocument::GCoderDocument() : Document(nullptr)
8989

9090
m_textEdit->setWindowIcon(QIcon(":/images/ncfile.png"));
9191
m_textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
92-
connect(m_textEdit, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(customContextMenuRequest(const QPoint&)));
92+
connect(m_textEdit, SIGNAL(customContextMenuRequested(const QPoint&)), this,
93+
SLOT(customContextMenuRequest(const QPoint&)));
9394
connect(m_textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
9495
connect(m_textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorMoved()));
9596
connect(m_textEdit, SIGNAL(selectionChanged()), this, SLOT(selectionUpdated()));
@@ -947,7 +948,8 @@ bool GCoderDocument::replaceAll(QString textToFind,
947948
return found;
948949
}
949950

950-
bool GCoderDocument::findText(const QString& text, bool findBackward, bool wholeWords, bool ignoreCase, bool ignoreComments)
951+
bool GCoderDocument::findText(const QString& text, bool findBackward, bool wholeWords, bool ignoreCase,
952+
bool ignoreComments)
951953
{
952954
bool inComment = false;
953955
bool found = false;

0 commit comments

Comments
 (0)