Skip to content

Commit

Permalink
Resolved : Merge conflict from PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
coder3101 committed Jan 9, 2020
2 parents 3d1e515 + 3fa4eb0 commit b86cb85
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 163 deletions.
4 changes: 2 additions & 2 deletions include/SettingsManager.hpp
Expand Up @@ -29,7 +29,8 @@
namespace Settings
{

enum ViewMode{
enum ViewMode
{
FULL_EDITOR,
FULL_IO,
SPLIT
Expand Down Expand Up @@ -190,7 +191,6 @@ class SettingManager
QKeySequence getHotkeyCompile();
QKeySequence getHotkeyViewModeToggler();


private:
QString mSettingsFile;
QSettings *mSettings;
Expand Down
16 changes: 11 additions & 5 deletions include/appwindow.hpp
Expand Up @@ -19,7 +19,7 @@ class AppWindow : public QMainWindow

public:
explicit AppWindow(QWidget *parent = nullptr);
explicit AppWindow(QVector<MainWindow *> tabs, QWidget *parent = nullptr);
explicit AppWindow(QStringList args, QWidget *parent = nullptr);
~AppWindow() override;

void closeEvent(QCloseEvent *event) override;
Expand Down Expand Up @@ -47,13 +47,15 @@ class AppWindow : public QMainWindow

void on_actionSave_triggered();

void on_actionSave_as_triggered();
void on_actionSave_As_triggered();

void on_actionSave_All_triggered();

void on_actionCheck_for_updates_triggered();

void onTabCloseRequested(int);
void onTabChanged(int);
void onEditorTextChanged(bool);
void onEditorTextChanged(bool, MainWindow *);
void onSaveTimerElapsed();
void onSettingsApplied();
void onSplitterMoved(int, int);
Expand All @@ -78,11 +80,12 @@ class AppWindow : public QMainWindow

void on_actionSplit_Mode_triggered();

private:
void on_confirmTriggered(MainWindow *widget);

private:
Ui::AppWindow *ui;
MessageLogger *activeLogger = nullptr;
QTimer *timer = nullptr;
QMetaObject::Connection activeTextChangeConnections;
QMetaObject::Connection activeSplitterMoveConnections;
QMetaObject::Connection companionEditorConnections;
Settings::SettingManager *settingManager = nullptr;
Expand All @@ -98,6 +101,9 @@ class AppWindow : public QMainWindow
bool diagonistics;
QVector<QShortcut *> hotkeyObjects;
void maybeSetHotkeys();
void closeAll();
bool closeTab(int index);
void openFile(QString fileName);
};

#endif // APPWINDOW_HPP
7 changes: 3 additions & 4 deletions include/mainwindow.hpp
Expand Up @@ -53,9 +53,7 @@ class MainWindow : public QMainWindow
void save(bool force);
void saveAs();

int windowIndeX() const;

bool closeChangedConfirm();
bool closeConfirm();

void killProcesses();
void detachedExecution();
Expand Down Expand Up @@ -98,7 +96,8 @@ class MainWindow : public QMainWindow
void on_changeLanguageButoon_clicked();

signals:
void editorTextChanged(bool isUnsaved);
void editorTextChanged(bool isUnsaved, MainWindow *widget);
void confirmTriggered(MainWindow *widget);

private:
const int windowIndex;
Expand Down
12 changes: 8 additions & 4 deletions src/CompanionServer.cpp
Expand Up @@ -48,7 +48,8 @@ void CompanionServer::updatePort(int port)
// server->setMaxPendingConnections(1);
QObject::connect(server, SIGNAL(newConnection()), this, SLOT(onNewConnection()));
server->listen(QHostAddress::LocalHost, static_cast<unsigned short>(port));
log->warn("Companion", "Port changed to " + std::to_string(port));
if (log != nullptr)
log->warn("Companion", "Port changed to " + std::to_string(port));
}

CompanionServer::~CompanionServer()
Expand All @@ -70,7 +71,8 @@ void CompanionServer::onReadReady()

if (request.startsWith("POST") && request.contains("Content-Type: application/json"))
{
log->info("Companion", "Got a POST Request");
if (log != nullptr)
log->info("Companion", "Got a POST Request");

socket->write("HTTP/1.1 OK\r\n"); // \r needs to be before \n
socket->write("Content-Type: text/html\r\n");
Expand Down Expand Up @@ -111,12 +113,14 @@ void CompanionServer::onReadReady()
}
else
{
log->error("Companion", "JSONParser reported errors. \n" + error.errorString().toStdString(), true);
if (log != nullptr)
log->error("Companion", "JSONParser reported errors. \n" + error.errorString().toStdString(), true);
}
}
else
{
log->warn("Companion", "An Invalid Payload was delivered on the listening port");
if (log != nullptr)
log->warn("Companion", "An Invalid Payload was delivered on the listening port");
socket->write("HTTP/1.1 OK\r\n"); // \r needs to be before \n
socket->write("Content-Type: text/html\r\n");
socket->write("Connection: close\r\n");
Expand Down
18 changes: 12 additions & 6 deletions src/SettingsManager.cpp
Expand Up @@ -374,17 +374,23 @@ void SettingManager::setHotkeyFormat(QKeySequence sequence)
ViewMode SettingManager::getViewMode()
{
QString strings = mSettings->value("view_mode", "split").toString();
if(strings == "split") return Settings::ViewMode::SPLIT;
else if(strings == "code") return Settings::ViewMode::FULL_EDITOR;
else return Settings::ViewMode::FULL_IO;
if (strings == "split")
return Settings::ViewMode::SPLIT;
else if (strings == "code")
return Settings::ViewMode::FULL_EDITOR;
else
return Settings::ViewMode::FULL_IO;
}

void SettingManager::setViewMode(ViewMode v)
{
QString ans;
if(v == Settings::FULL_EDITOR) ans = "code";
else if(v == Settings::FULL_IO) ans = "io";
else ans = "split";
if (v == Settings::FULL_EDITOR)
ans = "code";
else if (v == Settings::FULL_IO)
ans = "io";
else
ans = "split";
mSettings->setValue("view_mode", ans);
}

Expand Down

0 comments on commit b86cb85

Please sign in to comment.