Skip to content

Commit

Permalink
New template system and more refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcdorman committed Oct 7, 2012
1 parent 01069b2 commit 3e49988
Show file tree
Hide file tree
Showing 105 changed files with 3,902 additions and 1,414 deletions.
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SET(QT_USE_PHONON TRUE)

INCLUDE(${QT_USE_FILE})

FILE(GLOB INCLUDES ${INCLUDE}/*.h
FILE(GLOB INCLUDES ${INCLUDE}/*.hpp
${INCLUDE}/lexer/*
${INCLUDE}/dialogs/*
${INCLUDE}/widgets/*
Expand Down Expand Up @@ -80,7 +80,7 @@ ADD_LIBRARY(kisside STATIC ${KISS_SRCS_CXX})

SET(EXECUTABLE_OUTPUT_PATH ${KISS_SOURCE_DIR}/deploy)
SET(LIBRARY_OUTPUT_PATH ${KISS_SOURCE_DIR}/lib)
TARGET_LINK_LIBRARIES(KISS ${QT_LIBRARIES} qscintilla2 pcompiler tinyarchive z)
TARGET_LINK_LIBRARIES(KISS ${QT_LIBRARIES} qscintilla2 pcompiler)

IF(APPLE)
ADD_CUSTOM_TARGET(MacDeployQt ALL
Expand All @@ -106,6 +106,26 @@ ELSE(APPLE)
install(DIRECTORY ${RC}/templates DESTINATION ${KISS_SOURCE_DIR}/deploy)
ENDIF(APPLE)

IF(APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -headerpad_max_install_names")
ADD_CUSTOM_TARGET(kiss_osx_install_names ALL
COMMAND ${OSX_INSTALL_NAMES_SCRIPT} ${EXECUTABLE_OUTPUT_PATH}/KISS.app/Contents/MacOS/KISS
QtCore.framework/Versions/4/QtCore
QtScript.framework/Versions/4/QtScript
QtDBus.framework/Versions/4/QtDBus
QtGui.framework/Versions/4/QtGui
QtNetwork.framework/Versions/4/QtNetwork
QtXml.framework/Versions/4/QtXml
QtXmlPatterns.framework/Versions/4/QtXmlPatterns
QtSvg.framework/Versions/4/QtSvg
QtSql.framework/Versions/4/QtSql
QtWebKit.framework/Versions/4/QtWebKit
phonon.framework/Versions/4/phonon
QtDeclarative.framework/Versions/4/QtDeclarative
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
DEPENDS KISS Info.plist MacDeployQt)
ENDIF(APPLE)

# Accessory Programs

LINK_DIRECTORIES(${KISS_SOURCE_DIR}/lib)
Expand Down
20 changes: 20 additions & 0 deletions include/c_highlighter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef _C_HIGHLIGHTER_HPP_
#define _C_HIGHLIGHTER_HPP_

#include "syntax_highlighter.hpp"

#include <QHash>

class QTextDocument;

namespace Kiss
{
class CHighlighter : public SyntaxHighlighter
{
Q_OBJECT
public:
CHighlighter(QTextDocument *parent = 0);
};
}

#endif
76 changes: 76 additions & 0 deletions include/code_editor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#ifndef _CODE_EDITOR_HPP_
#define _CODE_EDITOR_HPP_

#include <QMap>
#include <QWidget>
#include <QPlainTextEdit>

namespace Kiss
{
namespace Widget
{
class CodeEditor;

class CodeEditorMargin : public QWidget
{
public:
CodeEditorMargin(CodeEditor *editor);
QSize sizeHint() const;

protected:
void paintEvent(QPaintEvent *event);

private:
CodeEditor *m_editor;
};

class MarginIndicator
{
public:
MarginIndicator(const QColor& color);
const QColor& color() const;

static const MarginIndicator& none();
private:
QColor m_color;

static MarginIndicator s_none;
};

class CodeEditor : public QPlainTextEdit
{
Q_OBJECT
public:
CodeEditor(QWidget *parent = 0);

void setEditorFont(const QFont& font);
QFont editorFont() const;
QFont marginFont() const;

void setMarginIndicator(const int& line, const MarginIndicator& indicator);
void clearIndicators();

quint16 marginSize() const;

friend class CodeEditorMargin;
protected:
void marginPaintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *e);
void scrollContentsBy(int dx, int dy);

void keyPressEvent(QKeyEvent *e);

private slots:
void highlightCurrentLine();
void updateMarginArea(const QRect& rect, const int& dy);
void updateMarginSize();

private:
QFont m_marginFont;
CodeEditorMargin *m_margin;
QMap<int, MarginIndicator> m_indicators;
};
}
}

#endif
56 changes: 0 additions & 56 deletions include/dialogs/template_dialog.hpp

This file was deleted.

25 changes: 25 additions & 0 deletions include/interface/dummy_interface.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef _DUMMY_INTERFACE_HPP_
#define _DUMMY_INTERFACE_HPP_

#include "interface.hpp"

#include <QObject>

namespace Kiss
{
namespace Target
{
class DummyInterface : public QObject, public Interface
{
Q_OBJECT
Q_INTERFACES(Kiss::Target::Interface)
public:
DummyInterface();

virtual const bool scan(Kiss::Target::InterfaceResponder *responder);
virtual void invalidateResponder();
};
}
}

#endif
35 changes: 35 additions & 0 deletions include/kar.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef _KAR_HPP_
#define _KAR_HPP_

#include <QString>
#include <QMap>
#include <QStringList>
#include <QByteArray>

namespace Kiss
{
class Kar
{
public:
bool addFile(const QString& name, const QByteArray& data);
void setFile(const QString& name, const QByteArray& data);
bool removeFile(const QString& name);
bool hasFile(const QString& name);
bool rename(const QString& name, const QString& newName);

QByteArray data(const QString& name) const;
QStringList files() const;

static Kar *create();
static Kar *load(const QString& path);
bool save(const QString& path);

private:
Kar();
Kar(const QMap<QString, QByteArray>& data);

QMap<QString, QByteArray> m_data;
};
}

#endif
24 changes: 18 additions & 6 deletions include/main_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "menu_manager.hpp"
#include "project_manager.hpp"
#include "project_model.hpp"
#include "main_window_menu.hpp"

#include <Qsci/qscilexercpp.h>
Expand All @@ -42,6 +43,11 @@ class QListWidgetItem;

namespace Kiss
{
namespace Template
{
class Manager;
}

namespace Widget
{
class SourceFile;
Expand All @@ -67,9 +73,9 @@ namespace Kiss
bool openFile(const QString& filePath);
bool memoryOpen(const QByteArray& ba, const QString& assocPath);
bool openProject(const QString& filePath);
bool newProject(const QString& filePath);
bool newProject(const QString& folderPath);

void initMenus(Tab* tab);
void initMenus(Tab *tab);

void initMenus();

Expand Down Expand Up @@ -142,10 +148,13 @@ namespace Kiss

Menu::Manager *menuManager();
Menu::Menuable* menuable(const QString& name);
QList<Menu::Menuable*> menuablesExcept(const QStringList& name);
QList<Menu::Menuable*> menuablesExcept(const QStringList& names);
void deactivateMenuablesExcept(const QStringList& names);
QList<Menu::Menuable*> menuables();
void activateMenuable(const QString& name, QObject *on);
QStringList standardMenus() const;

Template::Manager *templateManager() const;

void restart();

Expand All @@ -158,6 +167,8 @@ namespace Kiss
friend class Menu::MainWindowMenu;

public slots:
void importTemplatePack();
void newTemplatePack();
Project::Project *newProject();
void newFile();
void open();
Expand Down Expand Up @@ -198,19 +209,20 @@ namespace Kiss
void projectClicked(const QModelIndex& index);
void projectFileClicked(const QModelIndex& index);

void projectOpened(Project::Project *project);
void projectClosed(Project::Project *project);
void projectOpened(Kiss::Project::Project *project);
void projectClosed(Kiss::Project::Project *project);

private:
Tab *m_currentTab;
EditorSettingsDialog m_editorSettingsDialog;
ThemeSettingsDialog m_themeSettingsDialog;
QMap<QWidget *, Tab *> m_lookup;
Menu::Manager m_menuManager;
Template::Manager *m_templateManager;
Project::Manager m_projectManager;
QList<Menu::Menuable *> m_menuables;

// ProjectsModel m_projectsModel;
Project::Model m_projectsModel;

void addLookup(Tab *tab);
void removeLookup(QWidget* widget);
Expand Down
1 change: 1 addition & 0 deletions include/menus/menus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "menu_manager.hpp"
#include "target_menu.hpp"
#include "source_file_menu.hpp"
#include "template_pack_menu.hpp"
#include "web_tab_menu.hpp"
#include "main_window_menu.hpp"
#include "developer_menu.hpp"
Expand Down
Loading

0 comments on commit 3e49988

Please sign in to comment.