Skip to content

Commit

Permalink
Birçok İyileştirme Yapıldı ve Hatalar Giderildi.
Browse files Browse the repository at this point in the history
  • Loading branch information
CMLDMR committed Oct 19, 2018
1 parent dded6fa commit 9ef8cd2
Show file tree
Hide file tree
Showing 4 changed files with 820 additions and 173 deletions.
107 changes: 85 additions & 22 deletions src/davetiyewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DavetiyeWidget::DavetiyeWidget(mongocxx::database *_db, bsoncxx::document::view
:BaseWidget (_db),User (userDocument)
{

// mUser = new User(userDocument);
// mUser = new User(userDocument);

setMargin(15,Side::Bottom|Side::Top);

Expand Down Expand Up @@ -97,40 +97,102 @@ void DavetiyeWidget::initDavetiler()
itemContainer->addStyleClass(Bootstrap::Grid::Large::col_lg_3+Bootstrap::Grid::Medium::col_md_3+Bootstrap::Grid::Small::col_sm_3+Bootstrap::Grid::ExtraSmall::col_xs_6);
itemContainer->setAttributeValue(Style::style,Style::background::color::rgba(25,75,125));
auto vLayout = itemContainer->setLayout(cpp14::make_unique<WVBoxLayout>());
// auto text = vLayout->addWidget(cpp14::make_unique<WText>("Projeye Bak"),0,AlignmentFlag::Middle|AlignmentFlag::Center);
// text->setAttributeValue(Style::style,Style::color::color(Style::color::White::Azure)+Style::font::size::s16px+Style::font::weight::bold);
// auto text = vLayout->addWidget(cpp14::make_unique<WText>("Projeye Bak"),0,AlignmentFlag::Middle|AlignmentFlag::Center);
// text->setAttributeValue(Style::style,Style::color::color(Style::color::White::Azure)+Style::font::size::s16px+Style::font::weight::bold);

auto downloadlink = this->download(doc["dosya"].get_oid().value);
int redEtmis = 0;
try {
auto value = doc["uyeler"].get_array().value;

for( auto element : value )
{
if( element.get_document().view()["telno"].get_utf8().value.to_string() == this->getCeptel() )
{
redEtmis = element.get_document().view()["onay"].get_int32().value;
}
}

} catch (bsoncxx::exception &e) {
std::cout << "Line " << __LINE__ << "->in doc uyeler type is not " << "ar :"<< e.what() << std::endl;
}

if ( redEtmis == -1 ){

QFileInfo
info(doc["dosyaadi"].get_utf8().value.to_string().c_str());
auto text = vLayout->addWidget(cpp14::make_unique<WText>("Red Ettiniz"),
0,
AlignmentFlag::Center|AlignmentFlag::Middle );
text->setAttributeValue(Style::style,Style::font::size::s14px+Style::color::color(Style::color::White::AntiqueWhite)+Style::font::weight::bold);
text->setMargin(WLength::Auto,AllSides);
itemContainer->setAttributeValue(Style::style,Style::background::color::rgba(255,25,50));

QString newFileName =
QString("docroot/tempfile/") +
doc["dosya"].get_oid().value.to_string().c_str() +
"." + info.suffix().toStdString().c_str();

QString downloadFileName = QString("tempfile/")+doc["dosya"].get_oid().value.to_string().c_str() + "." +info.suffix().toStdString().c_str();
}else if( redEtmis == 1 ){
auto downloadlink = this->download(doc["dosya"].get_oid().value);

std::cout << "File Renamed: " << QFile::rename(QString("docroot/")+downloadlink.c_str(),newFileName) << std::endl;

QFileInfo
info(doc["dosyaadi"].get_utf8().value.to_string().c_str());

Wt::WLink link = Wt::WLink(downloadFileName.toStdString());
link.setTarget(Wt::LinkTarget::NewWindow);
QString newFileName =
QString("docroot/tempfile/") +
doc["dosya"].get_oid().value.to_string().c_str() +
"." + info.suffix().toStdString().c_str();

std::unique_ptr<Wt::WAnchor> anchor =
Wt::cpp14::make_unique<Wt::WAnchor>(link, "Projeye Bak");
QString downloadFileName = QString("tempfile/")+doc["dosya"].get_oid().value.to_string().c_str() + "." +info.suffix().toStdString().c_str();

{
auto text = vLayout->addWidget(std::move(anchor),
0,
AlignmentFlag::Center|AlignmentFlag::Middle );
text->setAttributeValue(Style::style,Style::font::size::s14px+Style::color::color(Style::color::White::AliceBlue)+Style::font::weight::bold);
text->setMargin(WLength::Auto,AllSides);
std::cout << "File Renamed: " << QFile::rename(QString("docroot/")+downloadlink.c_str(),newFileName) << std::endl;


Wt::WLink link = Wt::WLink(downloadFileName.toStdString());
link.setTarget(Wt::LinkTarget::NewWindow);

std::unique_ptr<Wt::WAnchor> anchor =
Wt::cpp14::make_unique<Wt::WAnchor>(link, "Projeye Bak");

{
auto text = vLayout->addWidget(std::move(anchor),
0,
AlignmentFlag::Center|AlignmentFlag::Middle );
text->setAttributeValue(Style::style,Style::font::size::s14px+Style::color::color(Style::color::White::AliceBlue)+Style::font::weight::bold);
text->setMargin(WLength::Auto,AllSides);
}

itemContainer->setAttributeValue(Style::style,Style::background::color::rgba(25,255,50));

}else{
auto downloadlink = this->download(doc["dosya"].get_oid().value);


QFileInfo
info(doc["dosyaadi"].get_utf8().value.to_string().c_str());

QString newFileName =
QString("docroot/tempfile/") +
doc["dosya"].get_oid().value.to_string().c_str() +
"." + info.suffix().toStdString().c_str();

QString downloadFileName = QString("tempfile/")+doc["dosya"].get_oid().value.to_string().c_str() + "." +info.suffix().toStdString().c_str();

std::cout << "File Renamed: " << QFile::rename(QString("docroot/")+downloadlink.c_str(),newFileName) << std::endl;


Wt::WLink link = Wt::WLink(downloadFileName.toStdString());
link.setTarget(Wt::LinkTarget::NewWindow);

std::unique_ptr<Wt::WAnchor> anchor =
Wt::cpp14::make_unique<Wt::WAnchor>(link, "Projeye Bak");

{
auto text = vLayout->addWidget(std::move(anchor),
0,
AlignmentFlag::Center|AlignmentFlag::Middle );
text->setAttributeValue(Style::style,Style::font::size::s14px+Style::color::color(Style::color::White::AliceBlue)+Style::font::weight::bold);
text->setMargin(WLength::Auto,AllSides);
}
}



}


Expand Down Expand Up @@ -257,6 +319,7 @@ void DavetiyeWidget::initDavetiler()
if( upt )
{
std::cout << "UPDATE: " << upt.value().modified_count() << std::endl;
this->initDavetiler();
}else{
std::cout << "No Document Updated" << std::endl;
}
Expand Down
Loading

0 comments on commit 9ef8cd2

Please sign in to comment.