42 #include <QMessageBox>
46 #include <QGridLayout>
48 #include <QPushButton>
52 m_DatabaseConnector(0),
53 ExistingImgSession(false)
86 vlayout->
setAlignment(RadioButtonLayout, Qt::AlignHCenter);
135 tr(
"You are currently using The Database %1 ").arg(
136 field(
"DBName").toString() ) );
167 std::vector< std::string > vectListProjName =
170 if ( !vectListProjName.empty() )
172 for (
unsigned int i = 0; i < vectListProjName.size(); ++i )
194 myNewProject.
SetField(
"Name",
field(
"ProjectName").toString().toStdString() );
206 "project", myNewProject);
216 std::stringstream AuthorName;
221 AuthorName <<
" <none>";
247 if ( !ListFirstNames.empty() )
249 for (
unsigned int i = 0; i < ListFirstNames.size(); i++ )
251 std::stringstream AuthorTotalName;
252 AuthorTotalName << ListLastNames[i];
253 AuthorTotalName <<
" ";
254 AuthorTotalName << ListFirstNames[i];
255 AuthorTotalName <<
" ";
256 AuthorTotalName << ListMiddleNames[i];
258 std::vector< FieldWithValue > Conditions(3);
259 FieldWithValue FirstName = {
"FirstName", ListFirstNames[i],
"=" };
260 Conditions[0] = FirstName;
261 FieldWithValue MiddleName = {
"MiddleName", ListMiddleNames[i],
"=" };
262 Conditions[1] = MiddleName;
264 Conditions[2] = LastName;
267 "author",
"AuthorID", Conditions);
272 QString AuthorName = ( *iter ).first.c_str();
277 ListAuthors.
append(AuthorName);
284 tr(
"Please create the author of your project:") );
298 "When you click on 'Next' the project will be created in the Gofigure Database\n or select 'Open an existing project':") );
329 tr(
"Select the project you want to open or choose 'Create a new project':") );
354 if ( ProjectName !=
"" )
364 std::vector< std::string > ResultQuery;
370 Description = ResultQuery[0].c_str();
379 int AuthorID = atoi( ResultQuery[0].c_str() );
392 if ( iter->second == AuthorID )
394 AuthorName = ( *iter ).first.c_str();
419 msgBox.
setText(
tr(
"Please enter a name for your new project.") );
426 msgBox.
setText(
tr(
"The name you entered for your project already exists.") );
433 msgBox.
setText(
tr(
"Please select an Author for your project.") );
509 field(
"ProjectName").toString().toStdString() );
511 return !ListImgSessionID.empty();
531 field(
"User").toString().toStdString(),
532 field(
"Password").toString().toStdString() );
533 CreateAuthorPage->
show();
QGoOpenCreateProjectPage(QWidget *parent=0)
std::string toStdString() const
QPushButton * NewAuthorButton
QComboBox * ChoiceProject
in the QTextEdit class, there is no method to have a restriction on the number of characters the user...
QStringList GetListAuthors()
return the QStringList of the authors to be visualized by the user (concatenation of the firstname...
void CreateProject()
insert the new project in the database with the information filled by the user
QRadioButton * CreateProjectRadioButton
QString toString(Qt::DateFormat format) const
void setText(const QString &)
QLineEdit * lineNewProjectName
void registerField(const QString &name, QWidget *widget, const char *property, const char *changedSignal)
void setSubTitle(const QString &subTitle)
bool CloseDatabaseConnection(vtkMySQLDatabase *DatabaseConnector)
return true if the connection has been closed, false if the connection was already closed ...
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void ChangeToOpenProjectDisplay()
hides/shows the related QLabel,QLineEdit...and display the related information of the first existing ...
vtkMySQLDatabase * OpenDatabaseConnection(std::string ServerName, std::string login, std::string Password, std::string DBName)
QString toPlainText() const
void ChangeToCreateProjectDisplay()
hides/shows the related QLabel,QLineEdit...and enables the fields where the user has to enter informa...
QString tr(const char *sourceText, const char *disambiguation, int n)
QTextEditChild * lineDescription
void setField(const QString &name, const QVariant &value)
void setBold(bool enable)
void append(const T &value)
QLabel * textChoiceAuthor
std::map< std::string, int > m_MapAuthorIDName
std::vector< std::string > ListAllValuesForOneColumn(vtkMySQLDatabase *DatabaseConnector, const std::string &ColumnName, const std::string &TableName, std::string OrderByColumnName)
SELECT ColumnName from TableName ORDER BY OrderbyColumnName.
void setText(const QString &text)
std::vector< std::string > ListSpecificValuesForOneColumn(vtkMySQLDatabase *iDatabaseConnector, const std::string &TableName, const std::string &ColumnName, const std::string &field, const std::string &value, bool ExcludeZero)
SELECT ColumnName FROM TableName WHERE field = value and ColumnName <> 0 (if excludezero) ...
QString OpenOrCreateProject
int FindOneID(vtkMySQLDatabase *DatabaseConnector, const std::string &TableName, const std::string &ColumnName, const std::string &field, const std::string &value)
SELECT ColumnName FROM TableName WHERE field = value.
void setText(const QString &)
QStringList m_ListProject
void DisplayInfoProject(QString ProjectName)
display the information related to the given existing project
QVariant field(const QString &name) const
void SetDatabaseVariables(std::string iUser, std::string iPassword)
bool contains(QChar ch, Qt::CaseSensitivity cs) const
vtkMySQLDatabase * m_DatabaseConnector
bool setAlignment(QWidget *w, QFlags< Qt::AlignmentFlag > alignment)
QLabel * textNewProjectName
std::string m_DatabaseVersion
void SetField(const std::string &key, const T &value)
convert the value into a string and assign it to the key in the map
void BackFromNextPage() const
void OpenDBConnection() const
open a connection to the database.
QRadioButton * OpenProjectRadioButton
int AuthorIDForNewProject()
return the AuthorID corresponding to the one in the database based on the name selected by the user i...
bool GetListProject() const
update the m_ListProject and return true if the list is not empty, false if there is no existing proj...
QLabel * textChoiceProject
void addItems(const QStringList &texts)
bool DoesProjectHaveExistingImgSession() const
get the list of the existing imaging session for the selected project and return true if the list is ...
void setReadOnly(bool ro)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setText(const QString &text)
manages a map with keys matching fields of the gofiguredatabase Project table and values of the map m...
void addLayout(QLayout *layout, int stretch)