Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SyntaxHighlighters/frequestjsonhighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

#include <QRegularExpression>
#include "frequestjsonhighlighter.h"

FRequestJSONHighlighter::FRequestJSONHighlighter(QTextDocument *parent)
Expand All @@ -25,7 +26,7 @@ FRequestJSONHighlighter::FRequestJSONHighlighter(QTextDocument *parent)

// Override colors
for(HighlightingRule &currRule : this->rules){
if(currRule.pattern == QRegExp("(true|false|null)(?!\"[^\"]*\")")){
if(currRule.pattern == QRegularExpression("(true|false|null)(?!\"[^\"]*\")")){
//reserved words
currRule.format.setForeground(QColor(0x0066ff));
break;
Expand Down
3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "mainwindow.h"
#include "utilglobalvars.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QCoreApplication::setApplicationName(GlobalVars::AppName);
QApplication a(argc, argv);

MainWindow w;
w.show();
a.setStyleSheet("QStatusBar::item { border: 0px; }"); //hide borders in status bar //http://qt-project.org/forums/viewthread/18743
Expand Down
17 changes: 16 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MainWindow::MainWindow(QWidget *parent) :
// We use this appender because it is the native way to have \r\n in windows in plog library
// example: https://github.com/SergiusTheBest/plog/blob/master/samples/NativeEOL/Main.cpp
static plog::RollingFileAppender<plog::TxtFormatter, plog::NativeEOLConverter<>> fileAppender
(QSTR_TO_TEMPORARY_CSTR(Util::FileSystem::getAppPath() + "/" + GlobalVars::AppLogFileName), 1024*5 /* 5 Mb max log size */, 3);
(QSTR_TO_TEMPORARY_CSTR(UtilFRequest::getAppDataFolder().absoluteFilePath(GlobalVars::AppLogFileName)), 1024*5 /* 5 Mb max log size */, 3);
plog::init(plog::info, &fileAppender);

this->currentSettings = this->configFileManager.getCurrentSettings();
Expand Down Expand Up @@ -195,6 +195,21 @@ void MainWindow::applicationHasLoaded(){
this->applicationIsFullyLoaded = true;
this->ignoreAnyChangesToProject.UnsetCondition();

QStringList args = QCoreApplication::arguments();

if(args.size() >= 2){
QString file = args.at(1);

if(QFileInfo::exists(file)){
loadProjectState(file);

return;
}
else{
Util::Dialogs::showWarning(QString("The project file \"%1\" does not exist.").arg(file));
}
}

if(this->currentSettings.recentProjectsPaths.size() > 0){

const QString &lastSavedProject = this->currentSettings.recentProjectsPaths[0];
Expand Down
2 changes: 1 addition & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private slots:
QList<QString> recentProjectsList;
QString lastResponseFileName;
int lastReplyStatusError = 0;
ConfigFileFRequest configFileManager = ConfigFileFRequest(Util::FileSystem::getAppPath() + "/" + GlobalVars::AppConfigFileName);
ConfigFileFRequest configFileManager = ConfigFileFRequest(UtilFRequest::getAppDataFolder().absoluteFilePath(GlobalVars::AppConfigFileName));
ConfigFileFRequest::Settings currentSettings;
const QSize auxMinimumSize = QSize(0,0);
const QSize auxMaximumSize = QSize(16777215,16777215);
Expand Down
4 changes: 2 additions & 2 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget_1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QScrollArea" name="scrollArea">
Expand Down Expand Up @@ -220,7 +220,7 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<widget class="QWidget" name="layoutWidget_2">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QTabWidget" name="twRequest">
Expand Down
10 changes: 10 additions & 0 deletions utilfrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "utilfrequest.h"
#include <QStandardPaths>

namespace UtilFRequest{

QDir getAppDataFolder()
{
QDir appDataFolder = QDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));

appDataFolder.mkdir(".");

return appDataFolder;
}

QString getDocumentsFolder(){

QString result = Util::FileSystem::normalizePath(QStandardPaths::locate(QStandardPaths::DocumentsLocation, QString(), QStandardPaths::LocateDirectory));
Expand Down
1 change: 1 addition & 0 deletions utilfrequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ struct RequestInfo{

static QMimeDatabase mimeDatabase;

QDir getAppDataFolder();
QString getDocumentsFolder();
bool requestTypeMayHaveBody(RequestType currentRequestType);
RequestType getRequestTypeByString(const QString &currentRequestText);
Expand Down