This commit is contained in:
fourtf
2018-02-05 21:20:38 +01:00
23 changed files with 255 additions and 104 deletions
+6 -2
View File
@@ -85,12 +85,16 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
if (doComplete) {
// check if there is a completer
return_if_not(this->completer);
if (!this->completer) {
return;
}
QString currentCompletionPrefix = this->textUnderCursor();
// check if there is something to complete
return_if_not(currentCompletionPrefix.size());
if (!currentCompletionPrefix.size()) {
return;
}
auto *completionModel =
static_cast<chatterino::singletons::CompletionModel *>(this->completer->model());
+2
View File
@@ -5,6 +5,7 @@
namespace chatterino {
namespace widgets {
namespace settingspages {
EmotesPage::EmotesPage()
: SettingsPage("Emotes", ":/images/emote.svg")
{
@@ -22,6 +23,7 @@ EmotesPage::EmotesPage()
layout->addStretch(1);
}
} // namespace settingspages
} // namespace widgets
} // namespace chatterino
+20 -6
View File
@@ -1,4 +1,5 @@
#include "logspage.hpp"
#include "singletons/pathmanager.hpp"
#include <QFormLayout>
#include <QVBoxLayout>
@@ -9,6 +10,16 @@ namespace chatterino {
namespace widgets {
namespace settingspages {
inline QString CreateLink(const QString &url, bool file = false)
{
if (file) {
return QString("<a href=\"file:///" + url + "\"><span style=\"color: white;\">" + url +
"</span></a>");
}
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + url + "</span></a>");
}
LogsPage::LogsPage()
: SettingsPage("Logs", "")
{
@@ -16,13 +27,16 @@ LogsPage::LogsPage()
util::LayoutCreator<LogsPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
{
auto form = layout.emplace<QFormLayout>();
singletons::PathManager &pathManager = singletons::PathManager::getInstance();
auto logPath = pathManager.logsFolderPath;
// clang-format off
form->addRow("Enabled:", this->createCheckBox("Enable logging", settings.enableLogging));
// clang-format on
}
auto created = layout.emplace<QLabel>();
created->setText("Logs are saved to " + CreateLink(logPath, true));
created->setTextFormat(Qt::RichText);
created->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
created->setOpenExternalLinks(true);
layout.append(this->createCheckBox("Enable logging", settings.enableLogging));
layout->addStretch(1);
}
@@ -13,6 +13,7 @@ namespace settingspages {
SpecialChannelsPage::SpecialChannelsPage()
: SettingsPage("Special channels", "")
{
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
util::LayoutCreator<SpecialChannelsPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
@@ -21,6 +22,12 @@ SpecialChannelsPage::SpecialChannelsPage()
mentions.emplace<QLabel>("Join /mentions to view your mentions.");
}
auto whispers = layout.emplace<QGroupBox>("Whispers").setLayoutType<QVBoxLayout>();
{
whispers.emplace<QLabel>("Join /whispers to view your mentions.");
whispers.append(this->createCheckBox("Show whispers inline", settings.inlineWhispers));
}
layout->addStretch(1);
}
} // namespace settingspages
-5
View File
@@ -139,11 +139,6 @@ ChannelPtr Split::getChannel() const
return this->channel;
}
ChannelPtr &Split::getChannelRef()
{
return this->channel;
}
void Split::setChannel(ChannelPtr _newChannel)
{
this->view.setChannel(_newChannel);
-1
View File
@@ -57,7 +57,6 @@ public:
const std::string &getUUID() const;
ChannelPtr getChannel() const;
ChannelPtr &getChannelRef();
void setFlexSizeX(double x);
double getFlexSizeX();
void setFlexSizeY(double y);
-13
View File
@@ -1,13 +0,0 @@
#include "titlebar.hpp"
namespace chatterino {
namespace widgets {
TitleBar::TitleBar(QWidget *parent)
: QWidget(parent)
{
setFixedHeight(32);
}
} // namespace widgets
} // namespace chatterino
+1 -8
View File
@@ -46,11 +46,6 @@ Window::Window(const QString &windowName, singletons::ThemeManager &_themeManage
QVBoxLayout *layout = new QVBoxLayout(this);
// add titlebar
// if (SettingsManager::getInstance().useCustomWindowFrame.get()) {
// layout->addWidget(&_titleBar);
// }
layout->addWidget(&this->notebook);
this->getLayoutContainer()->setLayout(layout);
@@ -63,9 +58,7 @@ Window::Window(const QString &windowName, singletons::ThemeManager &_themeManage
/// Initialize program-wide hotkeys
// CTRL+P: Open Settings Dialog
CreateWindowShortcut(this, "CTRL+P", [] {
SettingsDialog::showDialog(); //
});
CreateWindowShortcut(this, "CTRL+P", [] { SettingsDialog::showDialog(); });
// CTRL+Number: Switch to n'th tab
CreateWindowShortcut(this, "CTRL+1", [this] { this->notebook.selectIndex(0); });
+1 -2
View File
@@ -3,7 +3,6 @@
#include "util/helpers.hpp"
#include "widgets/basewindow.hpp"
#include "widgets/notebook.hpp"
#include "widgets/titlebar.hpp"
//#ifdef USEWINSDK
//#include <platform/borderless/qwinwidget.h>
@@ -65,7 +64,7 @@ private:
void loadGeometry();
Notebook notebook;
TitleBar titleBar;
// TitleBar titleBar;
friend class Notebook;