Skip to content

Commit

Permalink
feat: add load mouse style.
Browse files Browse the repository at this point in the history
Change-Id: I1b6a748e1a8dfaa422eb7697b468855d18dde1bd
  • Loading branch information
rekols committed Aug 27, 2018
1 parent a1796f9 commit 9ea1f8d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 10 additions & 1 deletion editor/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,22 @@ void Editor::loadFile(const QString &filepath)
QFile file(filepath);

if (file.open(QFile::ReadOnly)) {
auto fileContent = file.readAll();
// set mouse status to wait.
QApplication::setOverrideCursor(Qt::WaitCursor);

// reads all remaining data from the file.
QByteArray fileContent = file.readAll();

// read the encode.
m_fileEncode = Utils::getFileEncode(fileContent, filepath);

QTextStream stream(&fileContent);
stream.setCodec(m_fileEncode);
textEditor->setPlainText(stream.readAll());

// restore mouse style.
QApplication::restoreOverrideCursor();

updatePath(filepath);
detectNewline();

Expand Down
14 changes: 7 additions & 7 deletions editor/src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ Window::Window(DMainWindow *parent)
m_titlebarStyleSheet(titlebar()->styleSheet()),
m_themeName(m_settings->settings->option("base.theme.default")->value().toString())
{
m_blankFileDir = QDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()).filePath("blank-files");
m_readonlyFileDir = QDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()).filePath("readonly-files");
autoSaveDBus = new DBusDaemon::dbus("com.deepin.editor.daemon", "/", QDBusConnection::systemBus(), this);

// Init.
installEventFilter(this);
setAcceptDrops(true);

m_blankFileDir = QDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()).filePath("blank-files");
m_readonlyFileDir = QDir(QStandardPaths::standardLocations(QStandardPaths::DataLocation).first()).filePath("readonly-files");
autoSaveDBus = new DBusDaemon::dbus("com.deepin.editor.daemon", "/", QDBusConnection::systemBus(), this);
// Apply qss theme.
Utils::applyQss(this, "main.qss");
loadTheme(m_themeName);

// Init settings.
connect(m_settings, &Settings::adjustFont, this, &Window::updateFont);
Expand Down Expand Up @@ -157,10 +161,6 @@ Window::Window(DMainWindow *parent)
for (DSimpleListItem* item : m_themeBar->items) {
(static_cast<ThemeItem*>(item))->setFrameColor(frameSelectedColor, frameNormalColor);
}

// Apply qss theme.
Utils::applyQss(this, "main.qss");
loadTheme(m_themeName);
}

Window::~Window()
Expand Down

0 comments on commit 9ea1f8d

Please sign in to comment.