Skip to content

Commit

Permalink
updated to r5
Browse files Browse the repository at this point in the history
  • Loading branch information
emako committed Dec 15, 2018
1 parent c628794 commit 32f7710
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 8 deletions.
12 changes: 12 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ version r3
- added associated working of tcax-creator.
- fixed tcas can be saved in editor mode.
- fixed tass crash bug.

version r4
- fixed ui color-select button style.
- added python3.7.1 supported.
- updated qt framework ver to 5.12.0.

version r5
- added shortcut of Ctrl+R to compile the project.
- added folder tree context menu of open file with sys def and copy filename.
- changed folder tree context menu of remove and file will be removed really now.
- changed libtcc then font name will not be saved.
- rebuilded _cairo.pyd with py37 and the imp loading error will be solved.
11 changes: 10 additions & 1 deletion tcax-creator/com/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,16 @@ QString Common::fromJsonArray(const QJsonArray& a_jsonArray)
return QString(QJsonDocument(a_jsonArray).toJson());
}

bool Common::recycleFile(const QString &a_filename, QWidget *a_pHwnd)
bool Common::removeFile(const QString &a_filename, QWidget *a_pHwnd)
{
if(QMessageBox::question(a_pHwnd, MSG_QUESTION, QObject::tr("Remove the file \"%1\" ?").arg(a_filename), QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes)
{
return QFile(a_filename).remove();
}
return true;
}

QT_DEPRECATED bool Common::recycleFile(const QString &a_filename, QWidget *a_pHwnd)
{
bool ret = true;
SHFILEOPSTRUCT opRecycle;
Expand Down
8 changes: 6 additions & 2 deletions tcax-creator/com/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
#include <QSettings>
#include <QAction>
#include <QStyleFactory>
#include <QMessageBox>
#include <stdio.h>
#include <Windows.h>

class Config;

#define TCAX_CREATOR_VERSION "r4"
#define TCAX_CREATOR_VERSION "r5"

#define global

Expand Down Expand Up @@ -102,6 +103,8 @@ class Config;
#define RESOURCE_COMPILE_NONE ":/buttons/compile_error.png"
#define RESOURCE_COMPILE_WARN ":/buttons/compile_warning.png"

#define ACTION_FILE_SYSTEM_OPEN_WITH_SYS tr("Open with default")
#define ACTION_FILE_SYSTEM_COPY_FILENAME tr("Copy filename")
#define ACTION_FILE_SYSTEM_REMOVE tr("Remove")
#define ACTION_FILE_SYSTEM_BUILD tr("Build")
#define ACTION_FILE_SYSTEM_EXPLORE tr("Explore")
Expand Down Expand Up @@ -193,7 +196,8 @@ namespace Common
QJsonArray toJsonArray(const QString a_string);
QString fromJsonArray(const QJsonArray& a_jsonArray);

bool recycleFile(const QString &a_filename, QWidget *a_pHwnd = nullptr);
bool removeFile(const QString &a_filename, QWidget *a_pHwnd);
QT_DEPRECATED bool recycleFile(const QString &a_filename, QWidget *a_pHwnd = nullptr);

QFileInfoList getFolderList(QString a_path);
QFileInfoList getFileList(QString a_path);
Expand Down
6 changes: 4 additions & 2 deletions tcax-creator/designer/tcc_designer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ TccMap TccDesigner::getTccMap(void)
tccMap.insert(TCC_ALIGNMENT, m_pButtonGroupAlignment->checkedButton()->property(TCC_PROP_ALIGNMENT).toInt());

/* Font */
tccMap.insert(TCC_FONT_FACE_NAME, ui->comboBoxFontName->currentText());
//tccMap.insert(TCC_FONT_FACE_NAME, ui->comboBoxFontName->currentText());
tccMap.insert(TCC_FONT_FACE_NAME, NULLSTR);
if (ui->comboBoxFontNum->count() <= eINDEX_0)
{
tccMap.insert(TCC_FONT_FACE_ID, ui->comboBoxFontNum->currentText().toInt());
Expand Down Expand Up @@ -485,7 +486,8 @@ TCC_Attributes TccDesigner::getTccAttr(void)
tccAttr.alignment = m_pButtonGroupAlignment->checkedButton()->property(TCC_PROP_ALIGNMENT).toInt();

/* Font */
tccAttr.font_face_name = Common::toWCharT(ui->comboBoxFontName->currentText());
//tccAttr.font_face_name = Common::toWCharT(ui->comboBoxFontName->currentText());
tccAttr.font_face_name = Common::toWCharT(NULLSTR);
tccAttr.font_face_id = ui->comboBoxFontNum->currentIndex() + TCC_INDEX_OFFSET;
tccAttr.font_file = Common::toWCharT(ui->editFontFile->text());
tccAttr.font_size = ui->spinBoxFontSize->value();
Expand Down
23 changes: 20 additions & 3 deletions tcax-creator/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ void MainWindow::execArgument(void)

void MainWindow::keyPressEvent(QKeyEvent* event)
{
qDebug() << event->text();

if(event->text() == "\u0013") // Ctrl+S
{
save();
}
else if(event->text() == "\u0012") // Ctrl+R
{
projectCompile();
}
}

void MainWindow::closeEvent(QCloseEvent *event)
Expand Down Expand Up @@ -180,6 +186,8 @@ void MainWindow::setActions(void)
QJsonObject json;
QWidget *action_parent = ui->folderTreeView;
QList<QPair<QString, QAction *>> action_list = {
ACTION_NEW(ACTION_FILE_SYSTEM_OPEN_WITH_SYS, ":/buttons/page_white_go.png", action_parent),
ACTION_NEW(ACTION_FILE_SYSTEM_COPY_FILENAME, ":/buttons/page_white_stack.png", action_parent),
ACTION_NEW(ACTION_FILE_SYSTEM_REMOVE, ":/buttons/cross_grey.png", action_parent),
ACTION_NONE,
ACTION_NEW(ACTION_FILE_SYSTEM_BUILD, RESOURCE_COMPILE_NONE, action_parent),
Expand Down Expand Up @@ -628,7 +636,7 @@ void MainWindow::projectCompile(void)
QString targetFile;
QFileInfoList tccList = currentFolderTcc();

if(sender() == ui->actionCompile)
if(sender() == ui->actionCompile || sender() == nullptr)
{
if(tccList.length() == eINDEX_0)
{
Expand Down Expand Up @@ -829,9 +837,18 @@ void MainWindow::slotFileSystem(void)
QFileInfo fileinfo = m_model->fileInfo(ui->folderTreeView->currentIndex());
QString id = sender()->property(ACTION_PROP_ID).toString();

if(id == ACTION_FILE_SYSTEM_REMOVE)
if(id == ACTION_FILE_SYSTEM_OPEN_WITH_SYS)
{
QProcess::startDetached(QString("cmd /c \"%1\"").arg(fileinfo.filePath()));
}
else if(id == ACTION_FILE_SYSTEM_COPY_FILENAME)
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(fileinfo.filePath());
}
else if(id == ACTION_FILE_SYSTEM_REMOVE)
{
if(!Common::recycleFile(fileinfo.filePath(), this))
if(!Common::removeFile(fileinfo.filePath(), this))
{
QMessageBox::warning(this, MSG_WARNING, tr("Remove file failed!"));
}
Expand Down
Binary file added tcax-creator/res/buttons/application_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tcax-creator/res/buttons/bullet_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tcax-creator/res/buttons/file_extension_txt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tcax-creator/res/buttons/open_with.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tcax-creator/res/buttons/page_white_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tcax-creator/res/buttons/page_white_stack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tcax-creator/res/res.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,11 @@
<file>buttons/folder_link.png</file>
<file>scripts/lyric2ass.lua</file>
<file>scripts/png2ass.py</file>
<file>buttons/file_extension_txt.png</file>
<file>buttons/open_with.png</file>
<file>buttons/application_go.png</file>
<file>buttons/bullet_go.png</file>
<file>buttons/page_white_go.png</file>
<file>buttons/page_white_stack.png</file>
</qresource>
</RCC>
2 changes: 2 additions & 0 deletions tcax-creator/tcax-creator.pro
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ LUA_HEADER = $${COMMON_DIRECTORY}/lua/include
INCLUDEPATH += $${LUA_HEADER}
LIBS += -L$${LUA_LIB} -llua5.1

QMAKE_LFLAGS += /NODEFAULTLIB:library

CONFIG(debug, debug|release) {

contains(QMAKE_COMPILER, gcc) {
Expand Down

0 comments on commit 32f7710

Please sign in to comment.