Skip to content

Commit

Permalink
Some refactoring, will publish 0.9.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Rotter committed May 15, 2018
1 parent 775b614 commit 2103ebd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
3 changes: 1 addition & 2 deletions resources/text/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Microsoft Visual C++ redistributable must be installed. It is bundled in Textosa

Added:
* Macros sidebar which allows to record, play and save macros.
* Experimental Mac OS X build.
* Updates are checked automatically.
* Experimental Mac OS X build. There was some effor to make good DMG bundles but I failed. Therefore "app dir" is generated instead and Textosaurus core library is placed in the same folder as main Textosaurus executable.

Changed:
* Application is now split into two modules (executable + core library).
Expand Down
3 changes: 3 additions & 0 deletions src/libtextosaurus/saurus/gui/dialogs/formmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ FormMain::FormMain(QWidget* parent) : QMainWindow(parent), m_statusBar() {
FormAbout(this).exec();
});
}

// Display main window.
qDebug("Showing the main window when the application is starting.");
}

TabWidget* FormMain::tabWidget() const {
Expand Down
2 changes: 0 additions & 2 deletions src/libtextosaurus/saurus/gui/dialogs/formmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class TEXTOSAURUS_DLLSPEC FormMain : public QMainWindow {
friend class TextApplication;

public:

// Constructors and destructors.
explicit FormMain(QWidget* parent = nullptr);
virtual ~FormMain() = default;

Expand Down
10 changes: 10 additions & 0 deletions src/libtextosaurus/saurus/miscellaneous/textapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ void TextApplication::attachTextEditor(TextEditor* editor) {
connect(editor, &TextEditor::readOnlyChanged, this, &TextApplication::onEditorReadOnlyChanged);
}

void TextApplication::openPassedFilesOrNewDocument() {
// We load any documents passed as parameters.
if (qApp->arguments().size() > 1) {
loadFilesFromArgs(qApp->arguments().mid(1));
}
else if (tabWidget()->count() == 0) {
newFile();
}
}

void TextApplication::saveCurrentEditor() {
TextEditor* editor = tabWidget()->currentEditor();

Expand Down
1 change: 1 addition & 0 deletions src/libtextosaurus/saurus/miscellaneous/textapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class TEXTOSAURUS_DLLSPEC TextApplication : public QObject {
void attachTextEditor(TextEditor* editor);

// Load/save/new files.
void openPassedFilesOrNewDocument();
void newFile();
void reopenTextFile(QAction* action);
void openTextFile(QAction* action = nullptr);
Expand Down
1 change: 1 addition & 0 deletions src/libtextosaurus/saurus/plugin-system/pluginfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void PluginFactory::loadPlugins(TextApplication* text_app) {
// TODO: doladit, protože když se to volá tady,
// tak část property v text_app ani icons() není inicializovany,
// asi dát do hookPluginsIntoApplication
// A CELKOVE VYRESIT PORADI inicializace různých komponent
plugin->setTextApp(text_app, qApp->settings(), qApp->icons());

auto plugin_sidebars = plugin->sidebars();
Expand Down
18 changes: 4 additions & 14 deletions src/textosaurus/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,19 @@ int main(int argc, char* argv[]) {

// Set correct information for main window.
main_window.setWindowTitle(APP_LONG_NAME);

// Display main window.
qDebug("Showing the main window when the application is starting.");
main_window.show();

qApp->textApplication()->restoreSession();

// We load any documents passed as parameters.
if (application.arguments().size() > 1) {
qApp->textApplication()->loadFilesFromArgs(application.arguments().mid(1));
}
else if (qApp->textApplication()->tabWidget()->count() == 0) {
qApp->textApplication()->newFile();
}

// Now is a good time to initialize dynamic keyboard shortcuts.
DynamicShortcuts::load(qApp->userActions());
qApp->textApplication()->openPassedFilesOrNewDocument();

// Display tray icon if it is enabled and available.
if (SystemTrayIcon::isSystemTrayActivated()) {
qApp->showTrayIcon();
}

// Now is a good time to initialize dynamic keyboard shortcuts.
DynamicShortcuts::load(qApp->userActions());

// Enter global event loop.
return Application::exec();
}

0 comments on commit 2103ebd

Please sign in to comment.