But I lost everything on my hard drive, so i started fresh, and I am glad I did.
The applications intent (at this point) is to get two strings, file paths. And to, after the user is done typing;
check to see if it is a valid path. If so, a green text would appear to the right of the test field, saying "Ok".
If not, a red text would appear, saying "Error". Eventually I will add RSA style encryption algorithm's.
My problem is that, qmake doesn't seem to recognize STL/STD functions and objects. For example, when compiling
qmake seems to fail to notice fstream::open(). This is deeply troubling. Furthermore, I am getting a notice that I need a
"}" at the end of my .cpp. However, not only is one there, but it is the final closing brace?
fileManager.h
#ifndef FILEMANAGER_H_INCLUDED
#define FILEMANAGER_H_INCLUDED
#include <Qt/qstring.h>
#include <string.h>
#include <fstream>
#include <iostream>
using namespace std;
class fileMan
{
bool fileChk(string arg)
{
ifstream MyTmp;
MyTmp.open(arg, ios::in);
if (! MyTmp.is_open())
return false;
else MyTmp.close();
return true;
MyTmp.close();
}
void fileChk(string arg,QLabel argv)
{
ifstream MyTmp;
MyTmp.open(arg, ios::in);
if (! MyTmp.is_open())
{
argv.setText("<strong><font color='#ffff000'>Ok!</font></strong>");
}
else
{
argv.setText("<strong><font color='#c30000'>Error</font></strong>");
}
MyTmp.close();
}
#endif // FILEMANAGER_H_INCLUDED
manDialog.cpp
#include <Qt/qapplication.h>
#include <Qt/qwidget.h>
#include <Qt/qboxlayout.h>
#include <Qt/qlabel.h>
#include <Qt/qlineedit.h>
#include <Qt/qpushbutton.h>
#include <fileManager.h>
int main(int argc, char *argv[])
{
// Primary
QApplication appMain(argc, argv);
QWidget winMain;
winMain.resize(400,100);
QVBoxLayout winLayMain;
// Source
// Layout
QHBoxLayout srcLay;
// Members Declaration
QLineEdit srcLine;
QLabel srcTitle("File To Encrypt");
QLabel srcStat;
// Members Organization
srcLay.addWidget(&srcTitle);
srcLay.addWidget(&srcLine);
srcLay.addWidget(&srcStat);
// Finale
// Layout
QHBoxLayout finLay;
// Members Declaration
QLineEdit finLine;
QLabel finTitle("Output Location");
// Members Organization
finLay.addWidget(&finTitle);
finLay.addWidget(&finLine);
// Instruct
QLabel instructMain("Select a Text File To Encrypt.");
// Buttons
// Layout
QHBoxLayout buttLay;
// Members Declaration
QPushButton accept("Start");
QPushButton cancel("Cancel");
// Members Organization
buttLay.addWidget(&accept);
buttLay.addWidget(&cancel);
// Final Layout config
winLayMain.addWidget(&instructMain);
winLayMain.addLayout(&srcLay);
winLayMain.addLayout(&finLay);
winLayMain.addLayout(&buttLay);
// Finale Layout Configuration
winMain.setLayout(&winLayMain);
winMain.show();
/** SLOTS **/
QObject::connect(&srcLine, SIGNAL(editingFinished()), &appMain, SLOT(fileChk(toStdString(srcLine.text()),&srcStat)));
QObject::connect(&cancel, SIGNAL(clicked()), &appMain, SLOT(quit()));
return appMain.exec();
}
Compiler (qmake-qt4 -project && qmake-qt4 && make):
manDialog.cpp:63: error: expected `}' at end of input In file included from manDialog.cpp:8: ./fileManager.h: In member function ‘bool fileMan::fileChk(std::string)’: ./fileManager.h:17: error: no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::open(std::string&, const std::_Ios_Openmode&)’ /usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../include/c++/4.3.2/fstream:495: note: candidates are: void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>] ./fileManager.h: In member function ‘void fileMan::fileChk(std::string, QLabel)’: ./fileManager.h:27: error: no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::open(std::string&, const std::_Ios_Openmode&)’ /usr/lib/gcc/i386-redhat-linux/4.3.2/../../../../include/c++/4.3.2/fstream:495: note: candidates are: void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>] manDialog.cpp: At global scope: manDialog.cpp:63: error: expected unqualified-id at end of input
Any advice would be appreciated. I tried to find why the errors occurred, but there seems to be no reason?
Please check this thread often, I intend to continue to update it as I continue to develop.

New Topic/Question
Reply




MultiQuote





|